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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UNIX text file editing

Status
Not open for further replies.

ksoong

Programmer
Oct 3, 2000
57
CA
I need to edit lines in a text file using a ksh script.
The text file may have entries such as:

blah blah blah 1
blah blah blah 2
blah blah blah 3
.
.
.


I need to be able to edit specific lines without damaging the other lines in the text file. For example, if I need to make the text

blah blah blah 1
bl bl bl 2
blah blah blah 3
.
.
.


I need to edit only one line. Or i need to delete only one line. without damaging the other lines.


Does anyone know how I can do that?

Kenneth
 
do you need to do this a lot or just the once?

if once:
vi filename
:g/2$/blah/bl/g
:x

Mike
michael.j.lacey@ntlworld.com
 
sed -e &quot;2s/blah/bl/g&quot; < infile > outfile

for line 2.


Ged Jones

Top man
 
Do you have edit available? Ed Fair
efair@atlnet.com

Any advice I give is my best judgement based on my interpretation of the facts you supply.

Help increase my knowledge by providing some feedback, good or bad, on any advice I have given.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top