I was a little confused by the behaviour of -v with -B and -A,
how it works is like:

for i in a b a c a c; do echo $i; done | grep -v -B1 "c"
a
b
a
c <-- before match
a <-- match

what I was hoping it would do:
a
b

not output each "c", and also not outputting the line before it.

there is possibly some way to do it with git/diff
committing the initial output/the grep -v -B1 "c" output, and an empty file,
then merging diff from committing the empty file with the original one...
(that's what I did... but not sure if some output will have a conflict)

theres probably a better way to do it with sed, but if i could figure
it out I probably wuoldn't remember it anyways.

would this be something you guys would consider adding to grep via
some new option?

Reply via email to