How do I remove a character from a UNIX file?

Sơn Lê

Member
How do I remove a character from a UNIX file?
Answer
Remove CTRL-M characters from a file in UNIX
  1. The easiest way is probably to use the stream editor sed to remove the ^M characters. Type this command: % sed -e “s/^M//” filename > newfilename. …
  2. You can also do it in vi: % vi filename. Inside vi [in ESC mode] type: :%s/^M//g. …
  3. You can also do it inside Emacs.
 

Tìm kiếm

Back
Top