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.
Might try my luck here too
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[@]}"
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