|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
What's the command to remove empty lines with sed?
Code:
3 10 20 10 100 100 10000 Output: Code:
3 10 20 10 100 100 10000 ---------- Post updated at 07:59 AM ---------- Previous update was at 07:56 AM ---------- sed '/^$/d' file doesn't work. Last edited by cola; 09-03-2010 at 10:23 PM.. |
| Sponsored Links | |
|
|
|
#2
|
|||
|
|||
|
the empty lines are removed in your output
|
| Sponsored Links | ||
|
|
|
#3
|
|||
|
|||
|
No,file is the input file.
|
|
#4
|
|||
|
|||
|
oh so you mean output is your desired output. do those lines have tabs or spaces? if so they wont match that pattern.
|
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
No tab/spaces.
|
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
i dont believe you. post the output of this command Code:
od -cx input.file |
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
Code:
sed -n '/^$/!p' Last edited by Scott; 09-04-2010 at 05:48 AM.. Reason: Code tags |
| Sponsored Links | ||
|
|
![]() |
| Tags |
| remove empty lines |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| using vi -c to remove empty lines | Habitual | Shell Programming and Scripting | 3 | 08-17-2010 10:38 PM |
| perl or awk remove empty lines when condition | jimmy_y | Shell Programming and Scripting | 2 | 08-16-2010 08:00 PM |
| Using sed to remove lines where field is empty | figaro | Shell Programming and Scripting | 4 | 09-01-2009 03:07 PM |
| Removing empty lines(space) between two lines containing strings | sudhakaryadav | Shell Programming and Scripting | 3 | 06-02-2009 10:01 AM |
| Command/Script to remove duplicate lines from the file? | Rahulpict | Shell Programming and Scripting | 2 | 02-19-2009 09:13 PM |
|
|