Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-15-2004, 04:39 AM   #1
LQ Newbie
Registered: Apr 2004
Posts: 3

Rep: Reputation: 0
How do i remove blank lines from a file?

just wanna ask everybody how to remove blank lines from a file?
and also how to strip off comments from a file.. for eg...
echo a test #this is a comment
also from the following code line:
echo \#this is not a comment #this is a comment

thanks for your help!!!
Old 04-15-2004, 04:57 AM   #2
Registered: Mar 2004
Location: Jinhua, People's Republic of China
Distribution: MDK, RH, KNPX
Posts: 161

Rep: Reputation: 30
You can use grep. Here is an example:


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
Remove odd lines from a text file Mr. Gone Programming 2 09-19-2005 12:16 PM
How to remove lines from a file doza Linux - General 2 04-27-2005 12:59 PM
remove identical lines in a file benjithegreat98 Linux - General 4 04-24-2004 07:12 AM
[bash] remove lines from a file Drimo Programming 3 03-20-2004 12:16 PM
Replace blank/almost blank lines in file Wynd Linux - General 3 01-27-2004 05:49 PM

All times are GMT -5. The time now is 01:11 PM.

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