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

rpl command help??? 2

Status
Not open for further replies.

wellster34

Programmer
Sep 4, 2001
113
CA
Hi,

I have a data file, an example is shown below, called input.dat:

"1"
"2"
"3"

It contains double quotes around the numbers, so I want to replace the double quotes with a blank.

rpl '&quot;' &quot;&quot; < input.dat > new.dat

Now, when I run this, it returns what I want with the exeception that it adds a blank line at the end of file. So, instead of having 3 rows in the new.dat file, I now have 4! 3 rows like:
1
2
3

with an additional line that is a blank. [sad]

Is there a reason why a new blank line gets added? Is there a way to remove it? Or any other ideas on how to perform what I'm trying to do.

Thanks for your time.

 
wellster:

What you've described should not be leaving a blank line. You could use something like:

sed /^$/d data.file

to delete all blank lines from data.file.

Regards,

Ed
 
or try sed to do the whole job :

sed 's/\&quot;/ /g' infile > outfile

HTH Dickie Bird (:)-)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top