Experience: is what you get soon after you need it.

Experience: is what you get soon after you need it.

****************I am authoring a Book on Oracle Database Cloud Services.......More details to follow.***************

Title : Oracle Database Cloud Revealed
Publisher : Apress
Release Date : June-2018


Rasul Allah (sal Allahu alaihi wa sallam) said: "Restore the trusts of those who trust you, and deal not falsely with him who deals falsely with you." [Abu Dawud, Tirmidhi]

I am certified Oracle Cloud Architect:
Oracle Cloud Infrastructure 2018 Certified Architect Associate
Oracle Cloud Infrastructure Classic 2018 Certified Architect Associate

Search This Blog

Wednesday, July 13, 2011

remove ^M from files

if you want remove ^M characters from the files.

1) ftp the files using ascii mode


2) use dos2unix in Unix. (Most O.S should have this) if you don't


3) use any of the below for one time .

cat filename |perl -pe 's/\015\012/\n/g' > filename.without.ctrl.m


This will do an inline edit of the file, if you wish to do every file in the directory
perl -p -i -e 's/^M//g' *


sed 's/^M//g' ${INPUT_FILE} > tmp.txt

mv tmp.txt ${INPUT_FILE}


tr -d "\15" < ${INPUT_FILE} > tmp.txt;

mv tmp.txt ${INPUT_FILE}


For multiple files.

for f in `ls *.CSV` ###( change this .CSV to whatever file extensions you have)
mv $f ${f}~ && tr -d '\015\032' <${f}~ >$f
rm ${f}~

No comments: