When I do a build, I often use make --print-data-base
to debug my files. However, I don't always want to see the entire database.
The start of the database is denoted by # Make data base, printed on
and the stop by # Finished Make data base
.
I know I could make a script that would do this after the build is done - maybe I should just do that - but is there a way to do it with sed
?
make all --print-data-base 2>&1 | tee build-with-data-base.err | sed **something** | tee build-with-no-data-base.err
The issue I see here is that there is state involved: when you hit the start of the database portion, you turn the stream off and when you hit the end, you turn the stream back on.
Is it possible to do this with sed
or should I just do it with a script?
With GNU sed you can use ranges whose start and end are described by a /test/
:
echo "a
b
c
d
e
f" | sed '/b/,/e/d' # delete the lines from b to e
a
f
In your case you could possibly use the following sed
command :
sed '/# Make data base, printed on/,/# Finished Make data base/d'