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

How do I remove the ^M from my scripts?

Administration

How do I remove the ^M from my scripts?

by  comtec17  Posted    (Edited  )
Randomly when you write a script and change something in it using Windows Notepad/Wordpad and didn't run the dos2unix command, you will get a ^M after each line of code. To remove all the ^M's at once enter the following:

vi <your file name>
When you are in the file issue a colon :))then enter the following like this

:g/^M/s// /g

To get the ^M use the control + V and m simultainously.

Now :wq your file and you should be all good.

CoMteC17
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top