LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-06-2016, 02:57 PM   #1
sdscadc
LQ Newbie
 
Registered: Oct 2016
Posts: 2

Rep: Reputation: Disabled
deleting all spaces at end of line in vi


How can I delete, all (blank) spaces at end of each line in vi editor.
 
Old 10-06-2016, 03:12 PM   #2
ccj4467
LQ Newbie
 
Registered: Jan 2009
Posts: 15

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

Code:
sed 's/ *$//' oldfile > newfile
 
Old 10-06-2016, 03:26 PM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,243

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
Same in vi
 
1 members found this post helpful.
Old 10-07-2016, 03:23 AM   #4
MadeInGermany
Member
 
Registered: Dec 2011
Posts: 193

Rep: Reputation: 73
In vi it is a : command
Code:
:%s/ *$//
where the line address % is short for 1,$ (from 1st line to last line).
 
2 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Deleting a line that matches a string and also the line above it LinuxChiq Linux - Newbie 2 06-23-2012 06:29 PM
shell question: pad end of each line with spaces to = 80 chars ?? di11rod Programming 19 04-21-2011 08:03 PM
deleting duplicate lines without deleting first instance of the duplicated line jkeertir Linux - Newbie 2 02-07-2011 07:55 AM
Deleting empty line at end of text file in BASH human2.0 Linux - General 8 04-01-2009 03:44 AM
deleting all spaces at end of line in vi Tonatiuh Linux - General 4 08-16-2006 03:34 PM


All times are GMT -5. The time now is 10:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration