Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

grep lines between two patterns in unix

$ sed -n '/aaa/,/cdn/p' file
aaa
b12
cdn
$ sed -n '/zdk/,/dke/p' file
zdk
aaa
b12
cdn
dke
Source by unix.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #grep #lines #patterns #unix
ADD COMMENT
Topic
Name
1+6 =