My data is like:
Start abcd efgh hijk lmn
opq rst uvw xyz END
I want to
grep all the line between patterns START & END
even END pattern in next file
Output should be like:
abcd efgh hijk lmn opq rst uvw xyz
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
$ cat file1 file2 | awk '/pattern1/,/pattern2/'
sed -n '/start pattern/,/end pattern/p' file1 file2
For Saving Output To New File
sed -n '/start pattern/,/end pattern/p' file1 file2 > output
Which will create for you new file called output include the desired result.