I’d like to use sed to collect the top section from a set of files and output the collected result to a digest file. What I am currently doing almost works:
for i in foo/*/bazz.txt; do sed '/regexp/ q' $i >> bazzdigest.txt; done
The problem is that the line that matches /regexp/ also gets included. I don’t want to include it, so I have an extra-step of going into the file and removing it afterwards. Is there a way to do this so that that line does not get included?
Awk solution: