linux - sed command to copy lines that have strings -


i want copy line have strings file

for eg

a file contain below lines

ram 100 50 gopal 200 40 ravi 50 40 krishna 300 600 govind 100 34 

i want copy lines has 100 or 200 file skipping characters before (first occurrence in line)100 or 200

i want copy 100 50 200 40 100 34 file

i using sed -n '/100/p' filename > outputfile

can please me in adding lines 1 of string using single command

this might work (gnu sed):

sed -n '/[12]00/w anotherfile' file 

only print if needed, write anotherfile regexp matches 100 or 200.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -