Solved

deleting lines of a textfile from the command line?

Posted on 2001-07-18
1
187 Views
Last Modified: 2010-04-21
Hello,

I want to be able to parse through a text file for any line containing "_SOMETHING_" and remove these lines.

Can I do this in the command line or do I need to create a perl script?

Thanks,
Alex
0
Comment
Question by:Alex_Tong
1 Comment
 
LVL 6

Accepted Solution

by:
bira earned 30 total points
ID: 6296200
Hi

  Use fgrep as follow

  fgrep -v "_SOMETHING_" file > newfile
  mv newfile file


Regards
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question