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>

next in thread | raw e-mail | index | archive | help
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=3D1&ssid=3De-s5'
> | grep -A 100 =B6=D4=B1=C8 | mail -a 'Content-Type: text/plain; charse=
t=3DUTF-8' -s
> '=3D?UTF-8?B?'`w3m -dump
> 'http://search1.taobao.com/browse/33/n-g,w6y4zzjaxxymvjomxy-----------=
-----40--commen
d-0-all-33.htm?at_topsearch=3D1&ssid=3De-s5'
> | grep =D5=D2=B5=BD.*=BC=FE | base64 -w0`'?=3D' zhangweiwu@realss.com
>
>
> The stupid part of this script is it fetches the page 2 times and pars=
e
> 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 onc=
e, I copy the relevant sections into another file (a RAM file if it is s=
hort 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/BLSrjpTOVoKXC2vT8bG75jmaBuBB=
qrFnzp3RY2ufk0rwdaSjMZVA5BqOKCM/



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