Re: scripting an interactive web page

Daniel Pittman <[email protected]> Mon, 12 Apr 2010 17:36:29 +1000
Newsgroups gmane.org.user-groups.slug.chat
Message-ID <[email protected]>
"Voytek Eymont" <[email protected]> writes:
> On Sat, April 10, 2010 4:02 pm, Daniel Pittman wrote:
>> "Voytek Eymont" <[email protected]> writes:
>
>> awk '/^References/ { exit } { print }' input.text
>
> thanks, works good, though I now modified to get me page between 'Page' and
> 'References' like so
>
> awk '/Page/, /References/  { print }' file.ful  > file
>
> I also have multiple lines starting blank followed by 3 UPPER chars like:
>
> ' INT'
>
> how can I get rid of all lines starting with ' INT' ?

The GNU Awk documentation should be helpful in solving this sort of problem
generically, for the future: http://www.gnu.org/manual/gawk/gawk.html

(Also, if awk doesn't cut it, Perl, Python, and Ruby all have reasonable
 support for more complex versions of the same.)


My approach would be to reconsider how I was getting the input and see if
I could improve pre-processing by, for example, parsing the HTML and emitting
the content I actually wanted.

Alternately, you could just avoid printing any line that matched that pattern,
but I suspect this won't be the last additional requirement you find...

        Daniel
-- 
✣ Daniel Pittman            ✉ [email protected]            ☎ +61 401 155 707
               ♽ made with 100 percent post-consumer electrons
-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html