Re: Delete Next Blank Line IFF Current Line is Less than 80 Characters

Werfgam Nadler <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
----- Original Message -----

From: n22e113 <[email protected]>
To: [email protected]
Cc: 
Sent: Friday, July 20, 2012 10:25 PM
Subject: Re: Delete Next Blank Line IFF Current Line is Less than 80 Characters

On 7/14/2012 05:13, Thierry Blanc wrote:
> As you are in bash, you could use something like that:
>
> #!/bin/bash
>
> DEL=false # might delete a empty first line
> while read -r line
> do
> if $DEL && [[ -z "$line" ]]
> then
> DEL=false # and skip line
> else
> L=$(echo "$line" | wc -m )
> [[ $L -lt 80 ]] && DEL=true || DEL=false
> echo "$line" # print line
> fi
> done < "$1"
>
Thanks Thierry, Still would like a solution using a one-line sed. Will post if I find a solution.
Cheers!


Hi,

try this below. this will remove the blank line irrespective of its position from the line in consideration.


#### begin
/^.\{80\}/!{

:loop {
N;
/\n$/!bloop;
s/\n$//;
}
}
#### end.


thanks
nadler

[Non-text portions of this message have been removed]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.