Welcome to WebmasterWorld Guest from 54.204.100.232

Forum Moderators: bakedjake

Message Too Old, No Replies

Treating multiple lines as one?

Within shell

   
1:57 am on Nov 23, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there,

I have a small problem: I'm trying to download a page and extract a small bit of information from it (by splitting the page and then splitting the result of that split), but when I try to use awk to split the content, it seems to want to treat every line as a different input. How can I make it treat the entire piece as a whole?

Here's some sample code:


curl -A 'Mozilla/4.0' http://example.com ¦ awk '{split($0,a,"f");print a[2]}'
3:28 am on Nov 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Before the awk, try: tr '\n' ' '

That should turn the entire output into one line.