linux - extract file content from match pattern to another match pattern -


how extract file content match pattern match pattern. not split.

for example:

1.txt

myname myage myeducation myaddress > myoccupation mydesignation mysalary myofficename > mygrosssalary mypermanentaddress myfathersname 

in above file want extract content file , remove content starting pattern

> myoccupation 

to

> mygrosssalary 

to file.

with awk:

awk '/> myoccupation/,/> mygrosssalary/' file 

with sed:

sed -n '/> myoccupation/,/> mygrosssalary/p' file 

and can use output redirection create file, with

comand ... > newfile 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -