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

remove LF from windows text files 3

Status
Not open for further replies.

letis

Technical User
Sep 24, 2003
95
FR
Hello,

a quick question which I know could be adressed with awk or a vi macro, but I feel too lazy to dig the documentations :)))

I've got an ascii text file made under windows, thus each end of line is coded with a CR/LF.

I put this file on an AIX box (BTW, I thought a ftp transfer in ascii mode would have removed the LF but it's not the case).

So now, how to remove the LF from the text file (note : ok perhaps I make a confusion between the CR and LF code, I just remember 2 codes are used on windows to make a line feed, versus one on Unix) ??

regards,
 

Feeling lazy? - RTFM :)))

But for real, you are several tools to do it:

first is "tr" command
cat windowsfile.txt | tr -d "\015" > unixfile.txt

("\015" is the octal form of ASCII 13)

Other way is using dos2unix/unix2dos tools. But I feel using tr much more geek :)

--Trifo
 
nice command, one more I wasn't aware of, adopted !


thanks,
 
just as an amendment you could also vi the file and then:

:%s/<ctrl>v<ctrl>m//g
 
yeap, the vi macro is cool too :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top