sed scripting question

Forum thread started by humdinger on Thu, 2007-11-15 19:11

Hello there!

I have a textfile where I need to find some string and print out the whole paragraph that contains that string. (ETA: the paragraphs are seperated by an emtpy line.)

Since sed is black magic, I was fortunate to find a sed command that is supposed to do exactly what I want:

cat MyTextFile.txt | sed -e '/./{H;$!d;}' -e 'x;/MySearchString/!d;'

Unfortunately it doesn't work. Does anyone see what's wrong?

I also found that grep -p would do exactly what I want, but Haiku's grep doesn't know about that option... What's up with that?

If it helps, I can provide the whole script I'm trying to get to work.

Thanks guys!