It is currently Sat, 25 Oct 2014 15:48:38 GMT



 
Author Message
 Delete last character in a line
I need help deleting the last character in a line. The character is ^M
which I believe was put there during the ftp process. Does somebody
have a simple command or script that can delete this character from a
text file? The character is always placed a the end of each line.

Here's an example line:
attribute busyGreetingPointer busyGreetingPointer-oid cis^M

Thanks!

Sent via Deja.com http://www.**-**.com/
Before you buy.



 Tue, 08 Apr 2003 03:00:00 GMT   
 Delete last character in a line

Try:

tr '\012' '' < yourfile
or dos2unix() if available...

--
___________________________________________________________________________
Paul R. Brandariz           E-mail Internet: brand...@lore.kla-tencor.com
KLA-Tencor  Corporation
One Technology Dr.
Milpitas, CA 95035



 Tue, 08 Apr 2003 03:00:00 GMT   
 Delete last character in a line

This means the unix linebreaks were converted to DOS linebreaks. Simply
do:

tr -d '\r' < infile > outfile

Moshe

--
jehsom@ angband.org cc.gatech.edu polter.net shaftnet.org nullity.dhs.org
wreck.org bellsouth.net resnet.gatech.edu burdell.org yo.dhs.org gooning.org
usa.net togetherweb.com; gte741e mj116 @prism.gatech.edu; jacobsonconsulting@
usa.net; ICQ 1900670



 Tue, 08 Apr 2003 03:00:00 GMT   
 Delete last character in a line
You just deleted the newlines, not the carriage returns.
It should be '\015'.


 Tue, 08 Apr 2003 03:00:00 GMT   
 Delete last character in a line
Thanks Moshe...the file is as it should be.

Sent via Deja.com http://www.deja.com/
Before you buy.



 Tue, 08 Apr 2003 03:00:00 GMT   
 Delete last character in a line
You are right, my brain checked out for minute...
--
___________________________________________________________________________
Paul R. Brandariz           E-mail Internet: brand...@lore.kla-tencor.com
KLA-Tencor  Corporation
One Technology Dr.
Milpitas, CA 95035


 Tue, 08 Apr 2003 03:00:00 GMT   
 Delete last character in a line

In addition to the other answers, ftp text files in ASCII mode.



 Sat, 12 Apr 2003 05:49:30 GMT   
 
   [ 7 post ] 

Similar Threads

1. want to delete the last character of lines

2. Removing last character from last line in a file

3. Deleting Last Line of text file.

4. delete last nn lines

5. VI: Last Character in a Line

6. Deleting last line in a text file?

7. Removing last character of each line in a file

8. Delete first and last lines of file

9. Lines selection where the first character equals the last one

10. Script to delete last N lines from text file


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software