LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-06-2006, 12:56 AM   #1
wwnexc
Member
 
Registered: Sep 2005
Location: California
Distribution: Slackware & Debian
Posts: 264

Rep: Reputation: 30
Remove Blank Lines


Hi,

I am trying to format source code using astyle. So far it all works great, but i have not yet been able to remove empty lines from the code.

Is there any command to remove blank lines, either using astyle or an other program? I was thinking of something like this:
Code:
cat origianl.code | {program_here} | astyle --style=java -T > nice.code
Thanks!

Last edited by wwnexc; 05-06-2006 at 12:57 AM.
 
Old 05-06-2006, 01:20 AM   #2
Antonius_Block
LQ Newbie
 
Registered: Nov 2004
Location: D.C.
Distribution: FC3,4
Posts: 11

Rep: Reputation: 0
"sed /^$/d originl.code > nice.code" should do it.
 
Old 05-06-2006, 12:14 PM   #3
wwnexc
Member
 
Registered: Sep 2005
Location: California
Distribution: Slackware & Debian
Posts: 264

Original Poster
Rep: Reputation: 30
Thanks, Antonius_Block! That works like a charm. I was able to even remove lines with spaces by using

sed "/^[:space:]*$/d"

I didn't know about sed until now, thanks for the advise.
 
  


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
output number of blank lines tjgadu Linux - Newbie 7 06-09-2005 05:01 PM
vim: mark end-of-line? trim blank lines? prell Linux - Software 3 09-21-2004 12:04 AM
How do i remove blank lines from a file? kakho Programming 1 04-15-2004 04:57 AM
Replace blank/almost blank lines in file Wynd Linux - General 3 01-27-2004 05:49 PM
Screen goes blank(random) to vertical lines bruce1271 Linux - General 2 11-15-2003 12:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:46 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
Open Source Consulting | Domain Registration