Hulk-BASH$ cat somefile.txt
oh there is some stuff here
some more stuff here
START_LABEL
stuff I want
more stuff I want
END_LABEL
other stuff here too
and even more stuff here too
Hulk-BASH$
Hulk-BASH$ sed -n '/^START_LABEL/,/^END_LABEL/p' somefile.txt
START_LABEL
stuff I want
more stuff I want
END_LABEL
Hulk-BASH$
As you can see it's editing properly but I need the output to have the "LABELS" themselves removed so it looks like:
Hulk-BASH$ cat somefile.txt | awk -F 'START_LABEL' 'BEGIN{RS="END_LABEL"; OFS="\n"; ORS=""} {print $2}'
awk: syntax error near line 1
awk: bailing out near line 1
Hulk-BASH$
Thank you very much guys and to everyone who helped me.
Kind of weird about the whole awk vs. nawk in Solaris
I've got scripts that use awk (on Solaris) yet for the following I must use nawk
Anyway the code below works when substituting awk w/ nawk.
##nawk works
Hulk-BASH$ nawk '/^START_LABEL/{p=1;next}/^END_LABEL/{exit}p' somefile.txt
stuff I want
more stuff I want
Hulk-BASH$ awk '/^START_LABEL/{p=1;next}/^END_LABEL/{exit}p' somefile.txt
awk: syntax error near line 1
awk: bailing out near line 1
Hulk-BASH$
Thank you very much you guys have no idea as I'm new to sed and awk/nawk and I still find all this stuff foreign.