Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Jun 2009 08:14:10 GMT
From:      "gs_stoller@juno.com" <gs_stoller@juno.com>
To:        modulok@gmail.com, zhangweiwu@realss.com
Cc:        freebsd-questions@freebsd.org
Subject:   Re: scripting suggestion: how to make this command shorter
Message-ID:  <20090628.041410.20175.0@webmail07.dca.untd.com>

index | next in thread | raw e-mail

On 6/27/09, Zhang Weiwu <zhangweiwu@realss.com> wrote:
> Hello. I wrote this one-line command to fetch a page from a long uri,
> parse it twice: first time get subject & second time get content, and
> send it as email to me.
>
> $ w3m -dump
> 'http://search1.taobao.com/browse/33/n-g,w6y4zzjaxxymvjomxy----------------40--commen
d-0-all-33.htm?at_topsearch=1&ssid=e-s5'
> | grep -A 100 ¶Ô±È | mail -a 'Content-Type: text/plain; charset=UTF-8' -s
> '=?UTF-8?B?'`w3m -dump
> 'http://search1.taobao.com/browse/33/n-g,w6y4zzjaxxymvjomxy----------------40--commen
d-0-all-33.htm?at_topsearch=1&ssid=e-s5'
> | grep ÕÒµ½.*¼þ | base64 -w0`'?=' zhangweiwu@realss.com
>
>
> The stupid part of this script is it fetches the page 2 times and parse
> 2 times, thus making the command very long. If I can write the command
> in a way that the URI only appear once, then it is easier for me to
> maintain it. I plan to put it in cron yet avoid having to modify two
> places when the URI changes (and it does!).
>
> How do you suggest optimizing the one-liner?
>
               Whenever I have to look through a long file more than once, I copy the relevant sections into another file (a RAM file if it is short enough and I have the RAM) and then parse it there as many times as I need to do it.
____________________________________________________________
Criminal Lawyers - Click here.
http://thirdpartyoffers.juno.com/TGL2141/fc/BLSrjpTOVoKXC2vT8bG75jmaBuBBqrFnzp3RY2ufk0rwdaSjMZVA5BqOKCM/


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090628.041410.20175.0>