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

n22e113 <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
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!
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.