The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
remove blank lines in *.srt file :) hungbp UNIX for Dummies Questions & Answers 10 02-16-2008 08:40 AM
How to get last non-blank line? tqlam Shell Programming and Scripting 6 01-17-2008 07:13 PM
To remove Continous blank spaces from a file in UNIX arunkumar_mca UNIX for Dummies Questions & Answers 1 12-08-2006 01:10 AM
remove blank spaces in a string spandu Shell Programming and Scripting 2 03-02-2006 02:08 AM
Remove blank lines osymad UNIX for Dummies Questions & Answers 4 08-27-2005 06:41 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-23-2008
pcwiz pcwiz is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 34
Remove blank line - SED

HI, I have this list of apps like so:

Code:
DivX Products.app
DivX Support.app
Uninstall DivX for Mac.app
Build Applet.app
SpringBoard.app
Interface.app
MobileAddressBook.app
MobileSafari.app
MobileSlideShow.app
Preferences.app
Install Flash Player 8 OSX.app
Yap.app
check_afp.app

chess.app
There's that one blank line between "check_afp.app" and "chess.app". How do I remove that blank line? I've already tried "sed '/^$/d'" but it didn't work.
  #2 (permalink)  
Old 08-23-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Then the line isn't really blank.

Maybe something like grep -v '[A-Za-z0-9.,:;!?]' (or the equivalent in sed) could help remove it?
  #3 (permalink)  
Old 08-23-2008
pcwiz pcwiz is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 34
thanks

That did the trick, thanks
  #4 (permalink)  
Old 08-23-2008
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,508
Code:
sed '/^.$/d' file
please test on more data.
  #5 (permalink)  
Old 08-23-2008
pcwiz pcwiz is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 34
Same problem, that space still stays there...
  #6 (permalink)  
Old 08-23-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
We speculate that it's a DOS carriage return; if so, you might want to convert the whole file to Unix line ending conventions because otherwise, the problem will continue to haunt you whenever you need to match something at end of line, etc. See if dos2unix or your local equivalent would help (search these forums if you can't find a good command installed locally).
  #7 (permalink)  
Old 08-24-2008
pcwiz pcwiz is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 34
So how do I convert the file to UNIX line endings? And if anyone is wondering where I got the weird space from, it was written to the app by an AppleScript script. I told it to write a "return" to the file, following some text. The return should have put a normal line break in there, which it did, but it certainly is an unmanipulatable break.
Sponsored Links
Closed Thread

Bookmarks

Tags
line endings, macintosh, text conversion mac2unix

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:40 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0