• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 345
  • Last Modified:

Remove WhiteSpce From Unix File

Every line in my file has this at the end: ^M

I used to know a command to remove this, but forgot.

Please assist.
0
deharvy
Asked:
deharvy
  • 3
3 Solutions
 
Raheman M. AbdulCommented:
cat FILENAME|sed "s/^M//g">File2
mv File2 File1
0
 
Raheman M. AbdulCommented:
You can also try dos2unix command

dos2unix DOS-FILENAME filename

and then

mv filename DOS-FILENAME
0
 
Raheman M. AbdulCommented:
Another way within vi editor
Using sed command

sed 's:\^M::g' FILENAME

0
 
deharvyAuthor Commented:
dos2unix is the command I was thinking about. Thanks!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now