Home » Infrastructure » Unix » Shell command question
Shell command question [message #97989] Wed, 03 September 2003 12:45 Go to next message
MM
Messages: 27
Registered: July 2002
Junior Member
When i am converting a excel file as a csv(comma delimited file) and putting into UNIX as a flat file, at the end of each line i'm getting ^M. How do i get rid of it in the flat file
Re: Shell command question [message #97990 is a reply to message #97989] Thu, 04 September 2003 04:46 Go to previous messageGo to next message
Mark
Messages: 284
Registered: July 1998
Senior Member
to delete ^M use the command
dos2unix <file_orig> <file_dest>
Re: Shell command question [message #97991 is a reply to message #97989] Mon, 15 September 2003 14:20 Go to previous messageGo to next message
Sanjay Bajracharya
Messages: 279
Registered: October 2001
Location: Florida
Senior Member
Here is the trick:

1. FTP the file to UNIX.
2. vi the file and do this

shift-colon
%
s
/
control-v
control-m
/
/
enter

You should see something like this at the last line inside vi

:%s/^M//

You should be done.

Good luck
Re: Shell command question [message #97998 is a reply to message #97990] Thu, 02 October 2003 15:50 Go to previous message
Matt
Messages: 43
Registered: September 1999
Member
FYI
In hp-ux its dos2ux and you should probably redirect the output so:

dos2ux oldfilename > newfilename
Previous Topic: Run programs in Sun Solaris
Next Topic: How do I extend the table space for a database?
Goto Forum:
  


Current Time: Sat Jan 16 13:05:05 CST 2021