I am writing sed
expression which tries to print the text within a range of patterns:
apt-cache showpkg gdm | sed -n '/Reverse Depends:/,/Dependencies:/ p'
This basically works, current output is:
Reverse Depends:
libgdm1:i386,gdm 3.8.3-3~
...
...
gnome-control-center-data,gdm 3.0
Dependencies:
But I don't want the lines containing the patterns themselves, I want:
libgdm1:i386,gdm 3.8.3-3~
...
...
gnome-control-center-data,gdm 3.0
I know I can just just pipe the output to grep
with -v
option:
grep -v "Reverse Depends:"
But I hope sed
has an option for it. I have tried
$ apt-cache showpkg gdm | sed -n '/Reverse Depends:/-1,/Dependencies:/-1 p'
But it doesn't work:
sed: -e expression #1, char 19: unknown command: `-'