ux4me
1
Using these 2 comands to concatenate both outputs into single file:
cat testdata | awk 'BEGIN { FS="\n"; RS=""; } /<pattern1>/ {print}' > testdata1
cat testdata| awk '/<pattern2>/,EOF' >> testdata1
is it possible to combine both "awk" into 1-liner?
pls advise and thanks in advance.
what are you trying to do?
awk 'BEGIN { FS="\n"; RS=""; } /<pattern1>/ || /<pattern2>/' testdata > testdata1
ux4me
3
testdata file:
<start of file>
<some data>
<pattern1>
<error data>
<error data>
<pattern2>
...
<some data>
<eof>
<some
- trying to remove data between <pattern1> and <pattern2>
---------- Post updated at 01:31 AM ---------- Previous update was at 01:22 AM ----------
will this work?
sed -n '/pattern1/,/pattern2/d' testdata
Yes, why don't you try it!!!
Hello, ux4me:
-n = don't print each line by default
d = delete line
That sed will never print anything. It stands a chance however if you remove -n. As malcomex999 suggested, give it a try
Regards,
Alister
ux4me
6
works fine now.. thanks again for the quick help.