Welcome to WebmasterWorld Guest from 54.163.129.96

Forum Moderators: bakedjake

Message Too Old, No Replies

Treating multiple lines as one?

Within shell

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 15, 2004
posts:681
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 31, 2003
posts:1316
votes: 0


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

That should turn the entire output into one line.