Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You may read the entire contents of nutch-default.xml to a variable, edit the contents of that variable with xmlstarlet and then write the result back to nutch-default.xml again.</p> <p>Another way would be to use open file handles as described in <a href="https://stackoverflow.com/questions/2585438/redirect-output-from-sed-s-c-d-myfile-to-myfile">Redirect output from sed &#39;s/c/d/&#39; myFile to myFile</a> .</p> <pre><code>xmlstarlet --version # 1.0.6 xmlstarlet ed --help | less -Ip 'inplace' # 1. # in-place version using xmlstarlet only curl -L -s -o nutch-default.xml 'http://svn.apache.org/viewvc/nutch/branches/branch-1.3/conf/nutch-default.xml?view=co&amp;revision=1079746&amp;content-type=text%2Fplain' xmlstarlet edit -L -u "/configuration/property[name='http.agent.name']"/value -v 'test' nutch-default.xml xmlstarlet sel -t -c "/configuration/property[name='http.agent.name']"/value nutch-default.xml # 2. # variable version curl -L -s -o nutch-default.xml 'http://svn.apache.org/viewvc/nutch/branches/branch-1.3/conf/nutch-default.xml?view=co&amp;revision=1079746&amp;content-type=text%2Fplain' xmlstr="$(&lt; nutch-default.xml)" # save file contents to variable printf '%s\n' "$xmlstr" | xmlstarlet edit -u "/configuration/property[name='http.agent.name']"/value -v 'test' &gt; nutch-default.xml xmlstarlet sel -t -c "/configuration/property[name='http.agent.name']"/value nutch-default.xml # 3. # file handle version # cf. https://stackoverflow.com/questions/2585438/redirect-output-from-sed-s-c-d-myfile-to-myfile curl -L -s -o nutch-default.xml 'http://svn.apache.org/viewvc/nutch/branches/branch-1.3/conf/nutch-default.xml?view=co&amp;revision=1079746&amp;content-type=text%2Fplain' exec 3&lt;nutch-default.xml rm nutch-default.xml # prevent open file from being truncated xmlstarlet edit -u "/configuration/property[name='http.agent.name']"/value -v 'test' &lt;&amp;3 &gt;nutch-default.xml xmlstarlet sel -t -c "/configuration/property[name='http.agent.name']"/value nutch-default.xml </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload