If you have ever edited a piece of code on Windows (i.e: with Notepad or Wordpad), and then looked at it on Linux or FreeBSD, depending on your VI settings, chances are you will see the Windows return carriage (represented as "^M") after each and every line. This not only makes a mess of the file, but it can be tedious to clean line by line, especially if your dealing with a large chunk of code! Thankfully, the following line will remove the ^M Windows return carriage, removing whats in the quotes with your own file name(s):
tr -d '\r' < "myfile.c"> "mycleanfile.c"
This saves a lot of hassle, especially if you've edited a lot of files and haven't realised you've introduced ^M's every where. Although you could just use eclipse or Notepad++ which avoids the problem altogether on Windows!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment