Sed scripting question

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!

Might try my luck here too :slight_smile:
I’m working on an update for the djvu package (with haikuporter).
I’ve moved the binaries to a seperate tools package (not required to run the translator or an other app I’m looking into).
Problem is that in the tools package there are 2 cmd’s that are scripts and one can’t run defineDebugInfoPackage on it, so I need to exclude the 2 cmd’s any2djvu and djvudigital, I’m using some sed magic as I’ve found in the recipe for tiff4 but running into that script vs executable now, any ideas here?

debugList=(
	$libDir/libdjvulibre.so.$libVersion
	)
if [ -z "$secondaryArchSuffix" ]; then
	for i in `echo "$PROVIDES_tools" | sed -n -e "s/^\s*cmd://p"`; do
		debugList+=("${binDir/$portName/${portName}_tools}"/$i)
	done
fi
defineDebugInfoPackage $portName "${debugList[@]}"

Solved thanks to @augiedoggie ! :ok_hand:

debugList=(
	$libDir/libdjvulibre.so.$libVersion
	)
if [ -z "$secondaryArchSuffix" ]; then
	for i in `echo "$PROVIDES_tools" | grep -v no_debug | sed -n -e "s/^\s*cmd://p"`; do
		debugList+=("${binDir/$portName/${portName}_tools}"/$i)
	done
fi
defineDebugInfoPackage $portName "${debugList[@]}"

In the tools package add #no_debug after the 2 cmd’s

16 years later

Holy thread necromancy Batman! I mean, Begasus!

:stuck_out_tongue:

1 Like

It was the closest to topic I came accross :stuck_out_tongue:

HP should have wrappers for this kind of stuff.

1 Like