#!/bin/bash
s='<jnlp codebase="https://c...content-available-to-author-only...e.com/computer/jnlpAgentTest/" spec="1.0+">
    <information>
        <title>Agent for jnlpAgentTest</title>
        <vendor>Jenkins project</vendor>
        <homepage href="https://j...content-available-to-author-only...i.org/"/>
    </information>
    <security>
        <all-permissions/>
    </security>
    <resources>
        <j2se version="1.8+"/>
        <jar href="https://c...content-available-to-author-only...e.com/jnlpJars/remoting.jar"/>
    </resources>
    <application-desc main-class="hudson.remoting.jnlp.Main">
        <argument>b8c80148ce36de10c9358384fac9e28fbba941055a9a6ab2277e75ddc29a8744</argument>
        <argument>jnlpAgentTest</argument>
        <argument>-workDir</argument>
        <argument>/tmp/jnlpAgenttest</argument>
        <argument>-internalDir</argument>
        <argument>remoting</argument>
        <argument>-url</argument>
        <argument>https://c...content-available-to-author-only...e.com/</argument>
    </application-desc>
</jnlp>'
sed -n -e '/-workDir/{n' -e 's/.*>\([^<>]*\)<.*/\1/p' -e '}'  <<< "$s"
sed -n '/-workDir/{n;s/.*>\([^<>]*\)<.*/\1/p}' <<< "$s"