Apr 13, 2005 #1 ogniemi Technical User Nov 7, 2003 1,041 PL how to get from each stanza in a file first line (of the stanza) stanza1_line1 stanza1_line2 stanza1_line3 stanza2_line1 stanza2_line2 stanza3_line1 stanza3_line2 The mached lines should be: stanza1_line1 stanza2_line1 stanza3_line1
how to get from each stanza in a file first line (of the stanza) stanza1_line1 stanza1_line2 stanza1_line3 stanza2_line1 stanza2_line2 stanza3_line1 stanza3_line2 The mached lines should be: stanza1_line1 stanza2_line1 stanza3_line1
Apr 13, 2005 1 #2 PHV MIS Nov 8, 2002 53,708 FR A starting point: awk ' NF && !nr++ !NF{nr=0} ' /path/to/input > output Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244 Upvote 0 Downvote
A starting point: awk ' NF && !nr++ !NF{nr=0} ' /path/to/input > output Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
Apr 13, 2005 Thread starter #3 ogniemi Technical User Nov 7, 2003 1,041 PL thx. is it also possible to be done with sed? I am looking for a oneliner to this task. (but of course "awk '^JNF && !nr++^J!NF{nr=0}^J'" is ok!) Upvote 0 Downvote
thx. is it also possible to be done with sed? I am looking for a oneliner to this task. (but of course "awk '^JNF && !nr++^J!NF{nr=0}^J'" is ok!)