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/20/2012 14:38, Werfgam Nadler wrote:
> 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.
>
Hello, thanks! Reformatted to a one-liner and it works:
#!/bin/bash
sed '/^.\{80\}/!{ :loop { N; /\n$/!bloop; s/\n$//; } }' ./file
Many thanks!