LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   deleting all spaces at end of line in vi (https://www.linuxquestions.org/questions/linux-newbie-8/deleting-all-spaces-at-end-of-line-in-vi-4175590908/)

sdscadc 10-06-2016 01:57 PM

deleting all spaces at end of line in vi
 
How can I delete, all (blank) spaces at end of each line in vi editor.

ccj4467 10-06-2016 02:12 PM

Not sure in vi but this is a little sed statement that does it:

Code:

sed 's/ *$//' oldfile > newfile

grail 10-06-2016 02:26 PM

Same in vi :)

MadeInGermany 10-07-2016 02:23 AM

In vi it is a : command
Code:

:%s/ *$//
where the line address % is short for 1,$ (from 1st line to last line).


All times are GMT -5. The time now is 04:52 AM.