Tux

...making Linux just a little more fun!

Edit file from command line

Smile Maker [britto_can at yahoo.com]


Fri, 1 Jun 2007 01:19:37 -0700 (PDT)

Folks:

I need to do the following stuff:

Find the particular string in a file and remove that line which has that particular string from the file , that should be done from the command line or from the script.

Thanx... Britto


Top    Back


Kapil Hari Paranjape [kapil at imsc.res.in]


Fri, 1 Jun 2007 14:20:29 +0530

Hello,

On Fri, 01 Jun 2007, Smile Maker wrote:

>  Find the particular string in a file and remove that line which has
>  that particular string from the file , that should be done from the
>  command line or from the script.

Read all about it:

	man sed
In particular:
	sed -e'/REGEX_PATTERN/d' < input_file > output_file
Note that input_file and output_file need to be different.

Regards,

Kapil. --


Top    Back


Smile Maker [britto_can at yahoo.com]


Fri, 1 Jun 2007 03:07:24 -0700 (PDT)

Thanks Kapil and Neil

-- 
Britto

Top    Back


Neil Youngman [ny at youngman.org.uk]


Fri, 1 Jun 2007 09:55:08 +0100

On or around Friday 01 June 2007 09:19, Smile Maker reorganised a bunch of electrons to form the message:

>    Folks:
>
>  I need to do the following stuff:
>
>  Find the particular string in a file and remove that line which has that
> particular string from the file , that should be done from the command line
> or from the script.

Sounds like a homework question and we don't do people's homework for them.

I will give you a hint. Read the man page for grep.

Neil Youngman


Top    Back