curl ${URL} 2>/dev/null|grep "<${BLOCK}>"|sed -e "s/.*\<${BLOCK}\>\(.*\)\<\/${BLOCK}\>.*/\1/g"

extract XML RSS etc by tags such as or <code> or <description> </h1> <div class="description"> set BLOCK to "title" or any other HTML / RSS / XML tag and curl URL to get everything in-between e.g. some text </div> </div> <div class="col-md-4 col-lg-3"> <div class="votes"> <div class="pull-right voting-options" style="display:inline-block;margin-right:5px"> <a href="javascript:void(0)" class="vote-button"><i id="vote-up-12671" class="glyphicon glyphicon-chevron-up"></i></a><br/> <a href="javascript:void(0)" class="vote-button"><i id="vote-down-12671" class="glyphicon glyphicon-chevron-down"></i></a> </div> <div style="position:absolute;top:3px;right:1.3em;display:inline-block;" class="num-votes" id="num-votes-12671">0</div> <div class="clearfix"></div> </div> <div class="author" style="text-align:right"> By: <a href="/commands/by/c3w">c3w</a> </div> <div class="date" style="text-align:right"> 2013-08-31 14:53:54 </div> <div class="functions text-right"> <a href="/commands/using/grep">grep</a> <a href="/commands/using/sed">sed</a> <a href="/commands/tagged/34/bash">bash</a> <a href="/commands/tagged/235/curl">curl</a> <a href="/commands/tagged/351/regex">regex</a> <a href="/commands/tagged/501/html">html</a> <a href="/commands/tagged/653/xml">xml</a> <a href="/commands/tagged/737/rss">rss</a> <a href="/commands/tagged/2542/newsfeed">newsfeed</a> </div> <div class="text-right"> <span class="pull-right"> <a class="text-muted" href="#comment"> <span class="glyphicon glyphicon-comment"></span> 0</a> </span> <span class="pull-right" style="margin-right: 1em;"> <a class="favourite-link" href="javascript:void(0)"><i id="toggle-favourite-12671" class="glyphicon glyphicon-star-empty"></i></a> </span> </div> </div> <div class="col-md-12"> </div> <div class="btn-group" style="position:absolute;right:22px;margin-top:10px;cursor:pointer;"> <a class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-option-vertical"></span> </a> <ul class="dropdown-menu"> <li><a href="/commands/edit/0/12671" title="Submit a superior alternative">Submit alternative</a></li> <li role="separator" class="divider"></li> <li><a class="report-link" id="report-12671" href="javascript:void(0)" title="Report this command as malicious">Report as malicious</a></li> <li><a href="/commands/duplicate/12671" title="Report as duplicate">Report as a duplicate</a></li> </ul> </div> <!-- <div class="details"> <div class="votes"> <div class="num-votes" id="num-votes-12671">0</div> <div class="voting-options"> <a href="javascript:void(0)" class="vote-button" id="vote-up-12671">Up</a><br/> <a href="javascript:void(0)" class="vote-button" id="vote-down-12671">Down</a> </div> </div> </div> --> </div> </div> <div class="text-center" style="margin-bottom:20px;"> <a style="margin:auto;" class="btn btn-warning" href="/commands/edit/0/12671" >Submit An Alternative</a> </div> <div class="panel panel-default"> <div class="panel-heading" style="background:white"> <h2 class="panel-title">These Might Interest You </h2> </div> <ul class="list-group"> <li class="list-group-item one-liner"> <div class="col-md-10"> <div class="summary" style="font-size:1.5em;font-weight:bold;overflow:hidden"> <a href="/commands/view/3008/print-latest-top-10-top-3-or-commandlinefu.com-commands" title="Find out what others think of this command">print latest (top 10, top 3 or *) commandlinefu.com commands</a> </div> <div class="description" style="overflow:auto"> <p> This lengthy cryptic line will print the latest top 10 commandlinefu.com posts without their summaries. To print also their respective summaries use the following (even bigger) command line: <code>wget -qO - http://www.commandlinefu.com/feed/tenup | xmlstarlet sel -T -t -o '<doc>' -n -t -m rss/channel/item -o '<item>' -n -o '<title>' -v title -o '</title>' -n -o '<description>' -v description -o '</description>' -n -o '</item>' -n -t -o '</doc>' | xmlstarlet sel -T -t -m doc/item -v description/code -n -v title -n -n</code> It is recommended to include this line into a shell script to be easily run, as I do myself. You could also use the following URLs to browse the top 3 commands: <code>wget -qO - http://www.commandlinefu.com/feed/threeup | xmlstarlet ...</code> .. or all others: <code>wget -qO - http://feeds2.feedburner.com/Command-line-fu | xmlstarlet ...</code> PS: You need to install "xmlstarlet" to run it. It is found in Debian APT repositories (apt-get install xmlstarlet) or under the <a href="http://xmlstar.sourceforge.net/" rel="nofollow">http://xmlstar.sourceforge.net/</a> URL. <a class="text-muted" href="javascript:void(0)" onclick="Terminal.toggleSampleOutput($(this),$('sample-output-3008'))">Show Sample Output</a> </p> </div> <div style="display:none" class="sample-output" id="sample-output-3008"> <div class="output-meta"> This is sample output - yours may be different. </div> <div class="output"> <pre>$ ps aux | grep [p]rocess-name $ getconf LONG_BIT $ for I in $(mysql -e 'show databases' -s --skip-column-names); do mysqldump $I | gzip > $I.sql.gz"; done $ free && sync && echo 3 > /proc/sys/vm/drop_caches && free $ find . -empty -type d -exec rmdir {} + $ exiftool '-Directory<DateTimeOriginal' -d %Y/%m/%d dir $ tmpfile=$(mktemp) && echo -e 'startup_message off\nscreen -t top htop\nsplit\nfocus\nscreen -t nethogs nethogs wlan0\nsplit\nfocus\nscreen -t iotop iotop' > $tmpfile && sudo screen -c $tmpfile $ /sbin/kexec -l /boot/$KERNEL --append="$KERNELPARAMTERS" --initrd=/boot/$INITRD; sync; /sbin/kexec -e $ dig +short txt <keyword>.wp.dg.cx $ autossh -M50000 -t server.example.com 'screen -raAd mysession' $ knock <host> 3000 4000 5000 && ssh -p <port> user@host && knock <host> 5000 4000 3000 $ cat /var/log/secure.log | awk '{print substr($0,0,12)}' | uniq -c | sort -nr | awk '{printf("\n%s ",$0) ; for (i = 0; i<$1 ; i++) {printf("*")};}' $ for x in `jot - 0 2400 25`; do curl "http://www.commandlinefu.com/commands/browse/sort-by-votes/plaintext/$x" ; done > commandlinefu.txt $ ssh -t remote_host screen -r $ diff <(echo "$a") <(echo "$b")</pre> </div> </div> </div> <div class="col-md-2"> <div class="votes"> <div class="pull-right voting-options" style="display:inline-block;margin-right:5px"> <a href="javascript:void(0)" class="vote-button"><i id="vote-up-3008" class="glyphicon glyphicon-chevron-up"></i></a><br/> <a href="javascript:void(0)" class="vote-button"><i id="vote-down-3008" class="glyphicon glyphicon-chevron-down"></i></a> </div> <div style="position:absolute;top:3px;right:1.3em;display:inline-block;" class="num-votes" id="num-votes-3008">0</div> <div class="clearfix"></div> </div> </div> <div class="col-md-12"> <div class="line" title="Click to select this command" style="font-family:"> <span class="glyphicon glyphicon-usd" style="position:absolute;color:white;padding:.5em;font-size:85%;top:6px;"></span> <span style="padding-left:2em;overflow:auto" class="command code bash">wget -qO - http://www.commandlinefu.com/feed/tenup | xmlstarlet sel -T -t -o '&lt;x&gt;' -n -t -m rss/channel/item -o '&lt;y&gt;' -n -v description -o '&lt;/y&gt;' -n -t -o '&lt;/x&gt;' | xmlstarlet sel -T -t -m x/y -v code -n</span> </div> </div> <div class="col-md-12" style="padding-top:10px;"> <span class="author"> <a class="text-muted" href="/commands/by/fsilveira">fsilveira</a> </span> <span class="date text-muted"> · 2009-08-14 02:44:00 </span> <span class="pull-right" style="margin-right: 5em;"> <a class="text-muted" href="/commands/view/3008/print-latest-top-10-top-3-or-commandlinefu.com-commands#comment"> <span class="glyphicon glyphicon-comment"></span> 0</a> </span> <span class="pull-right" style="margin-right: 1em;"> <a class="pull-right favourite-link" href="javascript:void(0)"><i id="toggle-favourite-3008" class="glyphicon glyphicon-star-empty"></i></a> </span> </div> <div class="btn-group" style="position:absolute;right:10px;cursor:pointer"> <a class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-option-vertical"></span> </a> <ul class="dropdown-menu"> <li><a href="/commands/edit/0/3008" title="Submit a superior alternative">Submit alternative</a></li> <li role="separator" class="divider"></li> <li><a class="report-link" id="report-3008" href="javascript:void(0)" title="Report this command as malicious">Report as malicious</a></li> <li><a href="/commands/duplicate/3008" title="Report as duplicate">Report as a duplicate</a></li> </ul> </div> <div class="clearfix"></div> <!-- <div class="details"> <div class="meta"> <div class="functions"> Functions: <a href="/commands/using/wget">wget</a> </div> <div class="functions"> Tags: <a href="/commands/tagged/611/commandlinefu">commandlinefu</a> <a href="/commands/tagged/736/xmlstarlet">xmlstarlet</a> <a href="/commands/tagged/737/rss">rss</a> </div> </div> <div class="options"> </div> </div> --> </li> <li class="list-group-item one-liner"> <div class="col-md-10"> <div class="summary" style="font-size:1.5em;font-weight:bold;overflow:hidden"> <a href="/commands/view/5413/extract-title-from-html-files" title="Find out what others think of this command">Extract title from HTML files</a> </div> <div class="description" style="overflow:auto"> <p> Case Insensitive! and Works even if the "<title>...</title>" spans over multiple line. Simple! :-) <a class="text-muted" href="javascript:void(0)" onclick="Terminal.toggleSampleOutput($(this),$('sample-output-5413'))">Show Sample Output</a> </p> </div> <div style="display:none" class="sample-output" id="sample-output-5413"> <div class="output-meta"> This is sample output - yours may be different. </div> <div class="output"> <pre>Extract title from HTML files | commandlinefu.com </pre> </div> </div> </div> <div class="col-md-2"> <div class="votes"> <div class="pull-right voting-options" style="display:inline-block;margin-right:5px"> <a href="javascript:void(0)" class="vote-button"><i id="vote-up-5413" class="glyphicon glyphicon-chevron-up"></i></a><br/> <a href="javascript:void(0)" class="vote-button"><i id="vote-down-5413" class="glyphicon glyphicon-chevron-down"></i></a> </div> <div style="position:absolute;top:3px;right:1.3em;display:inline-block;" class="num-votes" id="num-votes-5413">4</div> <div class="clearfix"></div> </div> </div> <div class="col-md-12"> <div class="line" title="Click to select this command" style="font-family:"> <span class="glyphicon glyphicon-usd" style="position:absolute;color:white;padding:.5em;font-size:85%;top:6px;"></span> <span style="padding-left:2em;overflow:auto" class="command code bash">awk 'BEGIN{IGNORECASE=1;FS="<title>|</title>";RS=EOF} {print $2}' file.html</span> </div> </div> <div class="col-md-12" style="padding-top:10px;"> <span class="author"> <a class="text-muted" href="/commands/by/sata">sata</a> </span> <span class="date text-muted"> · 2010-04-20 10:54:03 </span> <span class="pull-right" style="margin-right: 5em;"> <a class="text-muted" href="/commands/view/5413/extract-title-from-html-files#comment"> <span class="glyphicon glyphicon-comment"></span> 0</a> </span> <span class="pull-right" style="margin-right: 1em;"> <a class="pull-right favourite-link" href="javascript:void(0)"><i id="toggle-favourite-5413" class="glyphicon glyphicon-star-empty"></i></a> </span> </div> <div class="btn-group" style="position:absolute;right:10px;cursor:pointer"> <a class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-option-vertical"></span> </a> <ul class="dropdown-menu"> <li><a href="/commands/edit/0/5413" title="Submit a superior alternative">Submit alternative</a></li> <li role="separator" class="divider"></li> <li><a class="report-link" id="report-5413" href="javascript:void(0)" title="Report this command as malicious">Report as malicious</a></li> <li><a href="/commands/duplicate/5413" title="Report as duplicate">Report as a duplicate</a></li> </ul> </div> <div class="clearfix"></div> <!-- <div class="details"> <div class="meta"> <div class="functions"> Functions: <a href="/commands/using/awk">awk</a> </div> <div class="functions"> Tags: <a href="/commands/tagged/64/linux">Linux</a> <a href="/commands/tagged/112/awk">awk</a> <a href="/commands/tagged/501/html">html</a> </div> </div> <div class="options"> </div> </div> --> </li> <li class="list-group-item one-liner"> <div class="col-md-10"> <div class="summary" style="font-size:1.5em;font-weight:bold;overflow:hidden"> <a href="/commands/view/5403/extract-title-from-html-files" title="Find out what others think of this command">Extract title from HTML files</a> </div> <div class="description" style="overflow:auto"> <p> This command can be used to extract the title defined in HTML pages </p> </div> <div style="display:none" class="sample-output" id="sample-output-5403"> <div class="output-meta"> This is sample output - yours may be different. </div> <div class="output"> <pre></pre> </div> </div> </div> <div class="col-md-2"> <div class="votes"> <div class="pull-right voting-options" style="display:inline-block;margin-right:5px"> <a href="javascript:void(0)" class="vote-button"><i id="vote-up-5403" class="glyphicon glyphicon-chevron-up"></i></a><br/> <a href="javascript:void(0)" class="vote-button"><i id="vote-down-5403" class="glyphicon glyphicon-chevron-down"></i></a> </div> <div style="position:absolute;top:3px;right:1.3em;display:inline-block;" class="num-votes" id="num-votes-5403">3</div> <div class="clearfix"></div> </div> </div> <div class="col-md-12"> <div class="line" title="Click to select this command" style="font-family:"> <span class="glyphicon glyphicon-usd" style="position:absolute;color:white;padding:.5em;font-size:85%;top:6px;"></span> <span style="padding-left:2em;overflow:auto" class="command code bash">sed -n 's/.*<title>\(.*\)<\/title>.*/\1/ip;T;q' file.html</span> </div> </div> <div class="col-md-12" style="padding-top:10px;"> <span class="author"> <a class="text-muted" href="/commands/by/octopus">octopus</a> </span> <span class="date text-muted"> · 2010-04-19 07:41:10 </span> <span class="pull-right" style="margin-right: 5em;"> <a class="text-muted" href="/commands/view/5403/extract-title-from-html-files#comment"> <span class="glyphicon glyphicon-comment"></span> 1</a> </span> <span class="pull-right" style="margin-right: 1em;"> <a class="pull-right favourite-link" href="javascript:void(0)"><i id="toggle-favourite-5403" class="glyphicon glyphicon-star-empty"></i></a> </span> </div> <div class="btn-group" style="position:absolute;right:10px;cursor:pointer"> <a class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-option-vertical"></span> </a> <ul class="dropdown-menu"> <li><a href="/commands/edit/0/5403" title="Submit a superior alternative">Submit alternative</a></li> <li role="separator" class="divider"></li> <li><a class="report-link" id="report-5403" href="javascript:void(0)" title="Report this command as malicious">Report as malicious</a></li> <li><a href="/commands/duplicate/5403" title="Report as duplicate">Report as a duplicate</a></li> </ul> </div> <div class="clearfix"></div> <!-- <div class="details"> <div class="meta"> <div class="functions"> Functions: <a href="/commands/using/sed">sed</a> </div> <div class="functions"> Tags: <a href="/commands/tagged/110/sed">sed</a> <a href="/commands/tagged/501/html">html</a> <a href="/commands/tagged/898/linux-unix">Linux UNIX</a> </div> </div> <div class="options"> </div> </div> --> </li> <li class="list-group-item one-liner"> <div class="col-md-10"> <div class="summary" style="font-size:1.5em;font-weight:bold;overflow:hidden"> <a href="/commands/view/5418/extract-title-from-html-files" title="Find out what others think of this command">Extract title from HTML files</a> </div> <div class="description" style="overflow:auto"> <p> not the best, uses 4 pipes! </p> </div> <div style="display:none" class="sample-output" id="sample-output-5418"> <div class="output-meta"> This is sample output - yours may be different. </div> <div class="output"> <pre></pre> </div> </div> </div> <div class="col-md-2"> <div class="votes"> <div class="pull-right voting-options" style="display:inline-block;margin-right:5px"> <a href="javascript:void(0)" class="vote-button"><i id="vote-up-5418" class="glyphicon glyphicon-chevron-up"></i></a><br/> <a href="javascript:void(0)" class="vote-button"><i id="vote-down-5418" class="glyphicon glyphicon-chevron-down"></i></a> </div> <div style="position:absolute;top:3px;right:1.3em;display:inline-block;" class="num-votes" id="num-votes-5418">1</div> <div class="clearfix"></div> </div> </div> <div class="col-md-12"> <div class="line" title="Click to select this command" style="font-family:"> <span class="glyphicon glyphicon-usd" style="position:absolute;color:white;padding:.5em;font-size:85%;top:6px;"></span> <span style="padding-left:2em;overflow:auto" class="command code bash">tr -d "\n\r" | grep -ioEm1 "<title[^>]*>[^<]*</title" | cut -f2 -d\> | cut -f1 -d\<</span> </div> </div> <div class="col-md-12" style="padding-top:10px;"> <span class="author"> <a class="text-muted" href="/commands/by/bandie91">bandie91</a> </span> <span class="date text-muted"> · 2010-04-20 18:55:24 </span> <span class="pull-right" style="margin-right: 5em;"> <a class="text-muted" href="/commands/view/5418/extract-title-from-html-files#comment"> <span class="glyphicon glyphicon-comment"></span> 0</a> </span> <span class="pull-right" style="margin-right: 1em;"> <a class="pull-right favourite-link" href="javascript:void(0)"><i id="toggle-favourite-5418" class="glyphicon glyphicon-star-empty"></i></a> </span> </div> <div class="btn-group" style="position:absolute;right:10px;cursor:pointer"> <a class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-option-vertical"></span> </a> <ul class="dropdown-menu"> <li><a href="/commands/edit/0/5418" title="Submit a superior alternative">Submit alternative</a></li> <li role="separator" class="divider"></li> <li><a class="report-link" id="report-5418" href="javascript:void(0)" title="Report this command as malicious">Report as malicious</a></li> <li><a href="/commands/duplicate/5418" title="Report as duplicate">Report as a duplicate</a></li> </ul> </div> <div class="clearfix"></div> <!-- <div class="details"> <div class="meta"> <div class="functions"> Functions: <a href="/commands/using/cut">cut</a> <a href="/commands/using/grep">grep</a> <a href="/commands/using/tr">tr</a> </div> <div class="functions"> Tags: <a href="/commands/tagged/64/linux">Linux</a> <a href="/commands/tagged/112/awk">awk</a> <a href="/commands/tagged/501/html">html</a> </div> </div> <div class="options"> </div> </div> --> </li> <li class="list-group-item one-liner"> <div class="col-md-10"> <div class="summary" style="font-size:1.5em;font-weight:bold;overflow:hidden"> <a href="/commands/view/40/echo-the-latest-commands-from-commandlinefu-on-the-console" title="Find out what others think of this command">Echo the latest commands from commandlinefu on the console</a> </div> <div class="description" style="overflow:auto"> <p> Self-referential use of wget. <a class="text-muted" href="javascript:void(0)" onclick="Terminal.toggleSampleOutput($(this),$('sample-output-40'))">Show Sample Output</a> </p> </div> <div style="display:none" class="sample-output" id="sample-output-40"> <div class="output-meta"> This is sample output - yours may be different. </div> <div class="output"> <pre>Command-Line-Fu send tweets to twitter (and get user details) $ curl --basic --user "user:pass" --data-ascii "status=tweeting%20from%20%the%20linux%20command%20line" http://twitter.com/statuses/update.json Changes standard mysql client output to 'less'. $ echo -e "[mysql]\npager=less -niSFX" >> ~/.my.cnf scping files with streamlines compression (tar gzip) $ tar czv file1 file2 folder1 | ssh user@server tar zxv -C /destination add all files not under version control to repository $ svn status |grep '\?' |awk '{print $2}'| xargs svn add Ping a URL sending output to file and STDOUT $ ping google.com | tee ping-output.txt</pre> </div> </div> </div> <div class="col-md-2"> <div class="votes"> <div class="pull-right voting-options" style="display:inline-block;margin-right:5px"> <a href="javascript:void(0)" class="vote-button"><i id="vote-up-40" class="glyphicon glyphicon-chevron-up"></i></a><br/> <a href="javascript:void(0)" class="vote-button"><i id="vote-down-40" class="glyphicon glyphicon-chevron-down"></i></a> </div> <div style="position:absolute;top:3px;right:1.3em;display:inline-block;" class="num-votes" id="num-votes-40">11</div> <div class="clearfix"></div> </div> </div> <div class="col-md-12"> <div class="line" title="Click to select this command" style="font-family:"> <span class="glyphicon glyphicon-usd" style="position:absolute;color:white;padding:.5em;font-size:85%;top:6px;"></span> <span style="padding-left:2em;overflow:auto" class="command code bash">wget -O - http://www.commandlinefu.com/commands/browse/rss 2>/dev/null | awk '/\s*<title/ {z=match($0, /CDATA\[([^\]]*)\]/, b);print b[1]} /\s*<description/ {c=match($0, /code>(.*)<\/code>/, d);print d[1]"\n"} '</span> </div> </div> <div class="col-md-12" style="padding-top:10px;"> <span class="author"> <a class="text-muted" href="/commands/by/root">root</a> </span> <span class="date text-muted"> · 2009-01-30 19:16:50 </span> <span class="pull-right" style="margin-right: 5em;"> <a class="text-muted" href="/commands/view/40/echo-the-latest-commands-from-commandlinefu-on-the-console#comment"> <span class="glyphicon glyphicon-comment"></span> 5</a> </span> <span class="pull-right" style="margin-right: 1em;"> <a class="pull-right favourite-link" href="javascript:void(0)"><i id="toggle-favourite-40" class="glyphicon glyphicon-star-empty"></i></a> </span> </div> <div class="btn-group" style="position:absolute;right:10px;cursor:pointer"> <a class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-option-vertical"></span> </a> <ul class="dropdown-menu"> <li><a href="/commands/edit/0/40" title="Submit a superior alternative">Submit alternative</a></li> <li role="separator" class="divider"></li> <li><a class="report-link" id="report-40" href="javascript:void(0)" title="Report this command as malicious">Report as malicious</a></li> <li><a href="/commands/duplicate/40" title="Report as duplicate">Report as a duplicate</a></li> </ul> </div> <div class="clearfix"></div> <!-- <div class="details"> <div class="meta"> <div class="functions"> Functions: <a href="/commands/using/awk">awk</a> <a href="/commands/using/wget">wget</a> </div> </div> <div class="options"> </div> </div> --> </li> <li class="list-group-item one-liner"> <div class="col-md-10"> <div class="summary" style="font-size:1.5em;font-weight:bold;overflow:hidden"> <a href="/commands/view/2736/simple-xml-tag-extract-with-sed" title="Find out what others think of this command">Simple XML tag extract with sed</a> </div> <div class="description" style="overflow:auto"> <p> Limited, but useful construct to extract text embedded in XML tags. This will only work if bar is all on one line. If nobody posts an alternative for the multiline sed version, I'll figure it out later... </p> </div> <div style="display:none" class="sample-output" id="sample-output-2736"> <div class="output-meta"> This is sample output - yours may be different. </div> <div class="output"> <pre></pre> </div> </div> </div> <div class="col-md-2"> <div class="votes"> <div class="pull-right voting-options" style="display:inline-block;margin-right:5px"> <a href="javascript:void(0)" class="vote-button"><i id="vote-up-2736" class="glyphicon glyphicon-chevron-up"></i></a><br/> <a href="javascript:void(0)" class="vote-button"><i id="vote-down-2736" class="glyphicon glyphicon-chevron-down"></i></a> </div> <div style="position:absolute;top:3px;right:1.3em;display:inline-block;" class="num-votes" id="num-votes-2736">4</div> <div class="clearfix"></div> </div> </div> <div class="col-md-12"> <div class="line" title="Click to select this command" style="font-family:"> <span class="glyphicon glyphicon-usd" style="position:absolute;color:white;padding:.5em;font-size:85%;top:6px;"></span> <span style="padding-left:2em;overflow:auto" class="command code bash">sed -n 's/.*<foo>\([^<]*\)<\/foo>.*/\1/p'</span> </div> </div> <div class="col-md-12" style="padding-top:10px;"> <span class="author"> <a class="text-muted" href="/commands/by/recursiverse">recursiverse</a> </span> <span class="date text-muted"> · 2009-07-23 07:59:30 </span> <span class="pull-right" style="margin-right: 5em;"> <a class="text-muted" href="/commands/view/2736/simple-xml-tag-extract-with-sed#comment"> <span class="glyphicon glyphicon-comment"></span> 0</a> </span> <span class="pull-right" style="margin-right: 1em;"> <a class="pull-right favourite-link" href="javascript:void(0)"><i id="toggle-favourite-2736" class="glyphicon glyphicon-star-empty"></i></a> </span> </div> <div class="btn-group" style="position:absolute;right:10px;cursor:pointer"> <a class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-option-vertical"></span> </a> <ul class="dropdown-menu"> <li><a href="/commands/edit/0/2736" title="Submit a superior alternative">Submit alternative</a></li> <li role="separator" class="divider"></li> <li><a class="report-link" id="report-2736" href="javascript:void(0)" title="Report this command as malicious">Report as malicious</a></li> <li><a href="/commands/duplicate/2736" title="Report as duplicate">Report as a duplicate</a></li> </ul> </div> <div class="clearfix"></div> <!-- <div class="details"> <div class="meta"> <div class="functions"> Functions: <a href="/commands/using/sed">sed</a> </div> <div class="functions"> Tags: <a href="/commands/tagged/6/shell-programming">Shell programming</a> <a href="/commands/tagged/110/sed">sed</a> <a href="/commands/tagged/653/xml">xml</a> </div> </div> <div class="options"> </div> </div> --> </li> </ul> </div> <div class="panel panel-default"> <div class="panel-heading" style="background-color:white"> <h3 class="panel-title">What do you think?</h3> <p>Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?</p> </div> <p class="text-center" style="margin:25px;">You must be <a href="/users/signin">signed in</a> to comment.</p> </div> <!--<script> function showspam(){window.location+="?nofilter=1",window.location.reload(!0)}var sf=0;$(document).ready(function(){var e=new URL(document.location).searchParams;"1"===e.get("nofilter")?console.log("spam filter off"):$("div.comment").each(function(){this.getElementsByTagName("a").length>2&&(0===sf?($(this).replaceWith("<div style='background-color:#eee; padding-bottom:10px; padding-left: 15px'><h3>Likely Spam Filtered</h3><p>One or more comments in this thread have been hidden from view. To view them anyway, click <a href='"+window.location+"?nofilter=1' onclick='showspam();'>here</a>.</p></div>"),sf=1):$(this).remove()),this.getElementsByTagName("p")[0].innerHTML.length>10&&this.getElementsByTagName("p")[0].innerHTML.includes("href")&&$(this).remove()})}); </script>--> </div> <div class="col-md-3 col-lg-4"> <div class="box-copy"> <h3 class="righthead">What's this?</h3> <div class="toggleable"> <p><strong>commandlinefu.com</strong> is the place to record those command-line gems that you return to again and again. That way others can gain from your <abbr title="Command-line interface">CLI</abbr> wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down. </p> <p class="text-center"><a class="btn btn-warning" href="/commands/edit"><strong><i class="glyphicon glyphicon-plus"></i> Share Your Commands</strong></a></p> <!-- <p>If you have a new feature suggestion or find a bug, please get in touch via <a href="http://commandlinefu.uservoice.com/"><strong>http://commandlinefu.uservoice.com/</strong></a><p>--> </div> </div> <hr /> <div class="box-copy"> <h3 class="righthead">Check These Out</h3> <p> <strong><a href="/commands/view/2921/benchmark-web-server-with-apache-benchmarking-tool">benchmark web server with apache benchmarking tool</a></strong> <br/> <span class="text-muted"><a class="text-muted" href="/commands/by/amaymon">amaymon</a> <span class="pull-right">10 </span> </span> </p> <p> <strong><a href="/commands/view/752/click-on-a-gui-window-and-show-its-process-id-and-command-used-to-run-the-process">Click on a GUI window and show its process ID and command used to run the process</a></strong> <br/> <span class="text-muted"><a class="text-muted" href="/commands/by/jackhab">jackhab</a> <span class="pull-right">9 </span> </span> </p> <p> <strong><a href="/commands/view/23444/which-processes-are-listening-on-a-specific-port-e.g.-port-80">Which processes are listening on a specific port (e.g. port 80)</a></strong> <br/> <span class="text-muted"><a class="text-muted" href="/commands/by/indexsmithy">indexsmithy</a> <span class="pull-right">1 </span> </span> </p> <p> <strong><a href="/commands/view/2319/awk-perform-a-rolling-average-on-a-column-of-data">Awk: Perform a rolling average on a column of data</a></strong> <br/> <span class="text-muted"><a class="text-muted" href="/commands/by/mungewell">mungewell</a> <span class="pull-right">3 </span> </span> </p> <p> <strong><a href="/commands/view/16406/get-aws-temporary-credentials-ready-to-export-based-on-a-mfa-virtual-appliance">Get AWS temporary credentials ready to export based on a MFA virtual appliance</a></strong> <br/> <span class="text-muted"><a class="text-muted" href="/commands/by/keymon">keymon</a> <span class="pull-right">1 </span> </span> </p> <p> <strong><a href="/commands/view/6985/detach-a-process-from-the-current-shell">Detach a process from the current shell</a></strong> <br/> <span class="text-muted"><a class="text-muted" href="/commands/by/strzel_a">strzel_a</a> <span class="pull-right">4 </span> </span> </p> <p> <strong><a href="/commands/view/2528/smiley-face-bash-prompt">Smiley Face Bash Prompt</a></strong> <br/> <span class="text-muted"><a class="text-muted" href="/commands/by/digitalsushi">digitalsushi</a> <span class="pull-right">18 </span> </span> </p> <p> <strong><a href="/commands/view/6788/broadcast-your-shell-thru-ports-5000-5001-5002-...">Broadcast your shell thru ports 5000, 5001, 5002 ...</a></strong> <br/> <span class="text-muted"><a class="text-muted" href="/commands/by/clvv">clvv</a> <span class="pull-right">38 </span> </span> </p> <p> <strong><a href="/commands/view/13129/find-partition-name-using-mount-point">Find partition name using mount point</a></strong> <br/> <span class="text-muted"><a class="text-muted" href="/commands/by/totti">totti</a> <span class="pull-right">2 </span> </span> </p> <p> <strong><a href="/commands/view/782/gzip-files-older-than-10-days-matching-">Gzip files older than 10 days matching *</a></strong> <br/> <span class="text-muted"><a class="text-muted" href="/commands/by/migueldiab">migueldiab</a> <span class="pull-right">4 </span> </span> </p> </div> <hr> <div class="box-copy"> <h3 class="righthead">Stay in the loop…</h3> <div class="toggleable"> <dl> <dt>Follow the Tweets.</dt> <dd> <a href="http://twitter.com/commandlinefu"><img class="link-img" src="/images/twitter.jpg" /></a> <p>Every new command is wrapped in a tweet and posted to <a href="http://twitter.com">Twitter</a>. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.</p> <p> » <a style="font-weight:bold;" href="http://twitter.com/commandlinefu">http://twitter.com/commandlinefu</a><br/> » <a style="font-weight:bold;" href="http://twitter.com/commandlinefu3">http://twitter.com/commandlinefu3</a><br/> » <a style="font-weight:bold;" href="http://twitter.com/commandlinefu10">http://twitter.com/commandlinefu10</a> </p> </dd> <dt>Subscribe to the feeds.</dt> <dd> <a style="font-weight:bold;" href="http://feeds2.feedburner.com/Command-line-fu"><img class="link-img" src="/images/rss.gif" /></a> <p>Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):</p> <p>Subscribe to the feed for:</p> <ul id="feed-links"> <li>» <a style="font-weight:bold;" href="http://feeds2.feedburner.com/Command-line-fu">all commands</a></li> <li>» <a style="font-weight:bold;" href="/feed/threeup">commands with 3 up-votes</a> (commandlinefu3)</li> <li>» <a style="font-weight:bold;" href="/feed/tenup">commands with 10 up-votes</a> (commandlinefu10)</li> </ul> </dd> </dl> </div> </div> <!-- <div class="box-copy"> <a class="visibility-toggle" id="box-copy-tags">Hide</a> <h3>Top Tags</h3> <div class="toggleable"><br> <a href="/commands/tagged/112/awk">awk</a>, <a href="/commands/tagged/34/bash">bash</a></li>, <a href="/commands/tagged/235/curl">curl</a>, <a href="/commands/tagged/123/find">find</a>, <a href="/commands/tagged/163/grep">grep</a>, <a href="/commands/tagged/64/linux">Linux</a>, <a href="/commands/tagged/110/sed">sed</a></li> </ul> </div> </div> <div class="box-copy"> <a class="visibility-toggle" id="box-copy-functions">Hide</a> <h3>Functions</h3> <div class="toggleable"> </div> </div> --> </div> </div> </div> <footer class="bs-footer" role="contentinfo" style="background-color:#F5F5F5;"> <div class="container"> <p style="padding-top:20px;">commandlinefu.com © 2018 <a href="https://www.danstools.com" target="_blank">Dan's Tools</a> | <a href="/site/faq">FAQs</a> | <a href="/site/api">API</a> | <a href="/site/widget">Widget</a> </p> </div> </footer> <!-- <div id="wrapper"> <div id="right-block"> </div> <div id="header"> <h4><a href="/commands/browse" title="commandlinefu.com - the greatest commands on the web"><img src="/images/header-logo.jpg" alt="commandlinefu.com" /></a></h4> <div id="nav"> <strong><a href="/commands/random" title="Lucky dip">Random</a></strong> | <strong><a href="/commands/browse/last-week/sort-by-votes" title="Piping host commands from the last 7 days">Hot this week</a></strong> | <strong><a href="/commands/browse/sort-by-votes" title="See the all-time greatest commands">All-time greats</a></strong> • <strong><a href="/site/faq"><abbr title="Frequently asked questions">FAQ</abbr></a></strong> | <strong><a href="/site/api"><abbr title="API documentation">API</abbr></a></strong> | <strong><a href="/site/widget"><abbr title="Javascript widget">Widget</abbr></a></strong> </div> <div id="search"> <form id="search-form" action="/search/handler" method="post" > <div id="search-container"> <img id="loading" src="/images/tag-loader.gif" style="display:none;float:right;margin: 5px 5px 0 0;" /> <input type="text" id="search-query" class="inactive" name="q" autocomplete="off" value="" placeholder="type here to grep the archive..." /> </div> </form> <div style="display:none" id="search-options"></div> </div> </div> <div id="left-block"> </div> <div id="footer"> <div class="advertising"> </div> </div> </div> --> <script src="//code.jquery.com/jquery-1.11.0.min.js"></script> <script> $.noConflict(); if (typeof Prototype !== "undefined" && Prototype.BrowserFeatures.ElementExtensions) { var disablePrototypeJS = function (method, pluginsToDisable) { var handler = function (event) { event.target[method] = undefined; setTimeout(function () { delete event.target[method]; }, 0); }; pluginsToDisable.each(function (plugin) { jQuery(window).on(method + '.bs.' + plugin, handler); }); }, pluginsToDisable = ['collapse', 'dropdown', 'modal', 'tooltip', 'popover', 'tab','collect']; disablePrototypeJS('show', pluginsToDisable); disablePrototypeJS('hide', pluginsToDisable); } </script> <script> jQuery( document ).ready(function() { hljs.initHighlightingOnLoad(); hljs.configure({useBR: true}); jQuery('span.code').each(function(i, block) { hljs.highlightBlock(block); }); }); </script> <script src="//netdna.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script> </body> </html>