# cat
emaillist
shahzad@example.com
shahzad.in@example.com
shahzad.out@example.com
alam@example.com
alam.out@example.com
Delete any
matched keyword form file. I am deleting
here .in@example.com
Use
following sed command:
# sed
'/.in@example.com/d' emaillist
Output:
shahzad@example.com
shahzad.out@example.com
alam@example.com
Redirect output in new file
# sed
'/.in@example.com/d' emaillist >emailnew
# cat
emailnew
shahzad@example.com
shahzad.out@example.com
alam@example.com
Delete keyword using –I option
under file
# sed -i
'/.in@example.com/d' emaillist
# cat
emaillist
shahzad@example.com
shahzad.out@example.com
alam@example.com
alam.out@example.com
0 comments:
Post a Comment