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
Post a Comment