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

Monday, May 17, 2010

Remove ^M character from UNIX

To remove ^M characters in UNIX

To get the ^M in unix ( press control+V control+m ) i.e ctrlv & ctrlm on your keyboard(no spaces in between)

do anyone of the following:

dos2unix filename ( not all unix flavors have dos2unix by default)

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}


perl -p -i -e 's/^M//g' ${INPUT_FILE}

multiple files in a directory

This will remove all the ^M from each file.
perl -p -i -e 's/^M//g' *

No comments: