Friday, 24 October 2014

Lynx usage in shell scripts

Lynx proved to be a very useful tool for avoiding complex shell scripts around html based reports and logs.
check the below command:

/apps/index/DRE_analysis_scripts/lynx -cfg=/apps/index/DRE_analysis_scripts/lynx.cfg -dump "http://dreprd2:9000/?action=getrequestlog&openlinks=on&refresh=0&tail=1000" >${OUTDIR}/DRE20_${TSTAMP}.txt 

The above shell snippet was useful for analyzing autonomy idol DRE server web based search transaction logs.
Those logs are not dumped to file with same format and i liked the web based format more than the standard content component logging.

Lynx helped me use this elegant log format from command line and apply standard shell filters like grep, cut etc. to it.

Lynx proved to be very handy too :)


1 comment:

  1. another useful construct to this:
    curl -u admin:amin http://myhaproxy:1200/ |lynx -stdin -dump |less

    this allows lynx to read from STDIN :)

    ReplyDelete