Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Delete Lines From File with pattern matching...

Status
Not open for further replies.

skb2005

IS-IT--Management
Mar 8, 2005
129
I have a huge text file. I want to delete the lines starting with "::1".

Some one told me that I would be easy to do in the vi editor. I was wondering how?
 
In vi, at the ex command line
g/^::1/d

Note: there are numerious ways via shell and Unix tools. - And probably better if the file is huge, such as:
sed '/^::1/d' < /input/file

Cheers,
ND [smile]
 
What about this ?
sed '/^::1/d' /path/to/input > output
or this ?
grep -v '^::1' /path/to/input > output

If you insist on vi:
:/^::1/d

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top