Computing.Net > Forums > Unix > sed question

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

sed question

Reply to Message Icon

Name: David
Date: November 15, 2002 at 06:38:38 Pacific
OS: UNIX/Solaris
CPU/Ram: Sun-sparc/16G
Comment:

Hi,

I want to delete some blank lines. I used the following command:
sed '/^$/d' file_name
or sed '/^ *$/d' file_name

But both failed to delete blank lines containing tabs. What can I do?

Thanks!




Sponsored Link
Ads by Google

Response Number 1
Name: jimbo
Date: November 15, 2002 at 07:27:25 Pacific
Reply:

Here is an awk way that does do tabs:

awk '$NF > 0' your_file

-jim


0

Response Number 2
Name: jimbo
Date: November 15, 2002 at 07:36:11 Pacific
Reply:

Here is a sed way:

sed '/^[ TAB]*$/d' your_file

That's the actual SPACE & TAB key pressed there.

-jim


0

Response Number 3
Name: David
Date: November 15, 2002 at 08:06:19 Pacific
Reply:

Both worked. Thanks!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: sed question

sed question www.computing.net/answers/unix/sed-question-/5518.html

Sed question www.computing.net/answers/unix/sed-question/6826.html

general sed question www.computing.net/answers/unix/general-sed-question/3935.html