Monday, December 2, 2013

How to grep multiple lines

file software.txt

wine
vlc
xpad
fluxbox
golang
shutter
google-earth
chrome
opera
fbreader
arora
pavu
virtualbox
flash
gns3
samba
chkconfig
rcconfig
acpi
rxvt
htop
lxappearanc
vim
rar
7z
thunar
synaptic
pidgin
xclip
mgrun
dia
gimp

chm
sync-iu
insync
iftop
nmap
skype
wireshark






- to grep "dia and gimp"

1- install pcregrep

#apt-get install pcregrep

2- search

# cat softwarel | pcregrep -M "dia.*\ngimp"
dia
gimp

No comments:

Post a Comment