Hi
I have managed to put text in a file by separating them by blank lines. I am trying to keep only those paragraphs that have a particular string. Though the Sed FAQ mentions a solution it does not work (see examples below)
http://www.catonmat.net/blog/sed-one-liners-explained-part-two/
58. Print a paragraph that contains “AAA”. (Paragraphs are separated by blank lines).
sed -e '/./{H;$!d;}' -e 'x;/AAA/!d;'
http://www.linuxhowtos.org/System/sedoneliner.htm?ref=news.rdf
# print paragraph if it contains AAA (blank lines separate paragraphs)
# HHsed v1.5 must insert a 'G;' after 'x;' in the next 3 scripts below
sed -e '/./{H;$!d;}' -e 'x;/AAA/!d;'
Can you please tell me why it is not working. Also if you know a solution with a unix tool or otherwise, please let me know.
Regards,
Suhaas