Solved

deleting lines of a textfile from the command line?

Posted on 2001-07-18
1
186 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
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.:

911 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now