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

Remove character from file

Status
Not open for further replies.

lambic

Technical User
Nov 28, 2002
68
GB
Help!

I have a file which has been FTP'd to my UNIX box for import into an ORACLE table.
My problem is the ORACLE system is rejecting the file as there is an extra character at the end of each record. This character is not visible on the PC where it originated from, but is when I 'view' the file on the UNIX box.
The character appears as ^M I think it may be a control character (<CR> or something).
I need to remove any occurences of this from the file (there are around 16000 records, I manually removed 10 of them & the 10 records imported OK into ORACLE). I don't fancy manually removing 16000 though!

Any help would be appreciated.

Cheers
 
Open the file in vi and then type:

:%s/[CTRL+v][CTRL+m]//


Thats Control plus the v key and then Control plus the m key. Then save the file.


-jim
 
Thanks Jim, worked great. You're a lifesaver!

 
transfer the file in ascii instead of binary and you won't get the ^M in the first place. --
| Mike Nixon
| Unix Admin
| ----------------------------
 
Have tried that - still had the character!
 
You can also do &quot;dos2unix filename&quot; without the quotes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top