Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Unix&Linux>>how to awk the *next* line?

how to awk the *next* line?

Hal Itosis
02-20-2006, 09:32 AM
For example, I'm tinkering with Cookies.plist
which has (among other entries) lines such as

<key>Domain</key>
<string>macdevcenter.com</string>
So I want to catch all domains (not just the .coms)
and process them. I know NR is the record number
(where the default for "record" equals one line),
so what I want might look something like these...
awk '/Domain/ NR+1 { print $0 }'
or:
awk '/Domain/ ++NR { print $0 }'Only those don't work. (Nor does 'defaults read')

Is there a way for awk to match some line...
and then do something with the *next* line?

[ There must be. ;) ]

hayne
02-20-2006, 09:46 AM
Maybe awk's range operators would help:
http://www.gnu.org/software/gawk/manual/html_node/Ranges.html

Hal Itosis
02-20-2006, 10:37 AM
YES! thank you.

awk '/Domain/ { getline; print }'
That GNU Guide is better than any
I have found thus far... just great.

Cheers.


 

TOP

Windows Server Outsell
Unix Signals And C++ E

For more info

Unix Signals And C++ E
Windows Server Outsell
bash not using my .bas
Applescript: Hide Proc
help with installing p
Mozilla install from d
ssh - don't want to us
Escaping quotes in Tig
Terminal Keybindings 
JAVA help, please! 

News Archive

Displaying Images on t
Install Office from th
Terminal Problem...? 
cc1plus not executable
desktop icons.. 
at & growlnotify 
unknown terminal type 
scp arbitrary files 
What and why is a 'Dis
permissions already me

Related stories:

Installing AutoCAD through UNIX
Shutdown/Boot from Terminal
Help!!! - can't compile c script on my Mac

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics