Ask Your Question

How to remove '$' character in a file using vim?

asked 2019-02-06 11:41:30 -0500

Abdul gravatar image

Hi, guys.

I've seen some characters in my file. Like this,


I don't need the character '$' in my file. I neither understood what is that character nor how to remove it.

I type the command, file data.txt and I got the result data.txt: Algol 68 source, ASCII text, with CRLF line terminators. But in another file it's different. file data2.txt — output: data2.txt: : ASCII text.

Could you tell me what does it mean and how to remove '$' character from my file?

Have a great day.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2019-02-06 14:19:35 -0500

villykruse gravatar image

Show the file contents using cat data.txt. If the "$" signs are really there, you remove them in vim using the command :s/\$$//. If the "$" sign are not there but only show up in vim, it is because the list mode is enabled. To turn it off: :set nolist. To turn it on: :set list.

You can convert the CRLF in the file using this command: :set ff=unix and then save the file.

edit flag offensive delete link more

answered 2019-02-08 11:19:17 -0500

abcool gravatar image

vim file_name > Press i > use keyboard to move cursor to right of $ and press backspace> Press :wq> Done.

edit flag offensive delete link more


if it doesn't allow write use sudo infront of vim file_name.

abcool gravatar imageabcool ( 2019-02-08 11:20:17 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-02-06 11:41:30 -0500

Seen: 55 times

Last updated: Feb 08