LinuxQuestions.org
Review your favorite Linux distribution.
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 07-09-2012, 02:56 PM   #1
vaibhavs17
Member
 
Registered: Mar 2009
Posts: 49

Rep: Reputation: 1
to get delete the blank lines from vi editor.


Hi Team,

Need your help,

How to delete the blank lines from a file?

file contents:

"Hello I am rohan

working with HP.

working on HPUX OS."

Above text has two blank lines how to delete such blank lines from vi editors?
 
Old 07-09-2012, 03:00 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,131
Blog Entries: 2

Rep: Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833
Google has many solutions for this, choose one: http://bit.ly/PBYPmJ
 
1 members found this post helpful.
Old 07-09-2012, 03:23 PM   #3
vaibhavs17
Member
 
Registered: Mar 2009
Posts: 49

Original Poster
Rep: Reputation: 1
Thanks TobiSGD

I got the solution

how to delete blank lines in vi editor
:g/^$/d
:v/./d
 
1 members found this post helpful.
Old 07-09-2012, 04:09 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,131
Blog Entries: 2

Rep: Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833
Thanks for posting back a solution.
 
  


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
to delete blank lines rokshana Linux - General 1 05-31-2012 01:02 AM
[SOLVED] Perl: how to replace blank lines in a file with given lines from another karamaz0v Programming 8 04-19-2012 07:48 AM
Sed. Delete blank lines between two patterns supersoni3 Programming 5 07-29-2010 11:40 AM
sed/awk: Three consecutive blank lines in a file, how to delete two of them? recomboDNA Programming 8 06-17-2010 10:50 AM
how do I delete *certain* lines in vi editor? zim64half Linux - General 3 04-23-2007 08:39 PM


All times are GMT -5. The time now is 11:09 AM.

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