Remove empty lines from file
Ryan Schmidt
ryandesign at macports.org
Fri Nov 18 14:59:29 PST 2011
On Nov 18, 2011, at 16:21, Bradley Giesbrecht wrote:
> I have tried 1 to 5 escapes to replace a newline and/or carriage returns with nothing.
>
> reinplace "s|\n||g" file_path
> also
> reinplace -E "s|\n||g" file_path
>
> Looking at other ports I see 1, 2 and 3 escapes inside double quotes.
>
> Does anyone have an known working example?
Simplest way I know of removing empty lines with sed is:
reinplace "/^$/d" ${file}
More information about the macports-dev
mailing list