[Chicago-talk] Replacing consecutive newlines with a single newline
Jay Strauss
me at heyjay.com
Thu Sep 25 18:09:01 PDT 2008
Is it that the shell is eating your "\" chars?
Will:
perl -pe 's/(\\n)+/\\1/g' inputfile
work?
On Thu, Sep 25, 2008 at 8:04 PM, Vijay Kumar <vjcang at gmail.com> wrote:
> Hi,
> I need to do it as part of unix command line invocation.
> I thought I knew it but after trying for almost one hour I am still
> unable to get it right.
> Your ideas much appreciated.
>
> perl -pe 's/(\n)+/\1/g' inputfile
> perl -pe 's/(\n)+/\1/sg' inputfile
> are not working.
>
> I see the following reduces consecutive 'x' s to a single 'x'
> perl -pe 's/(x)+/\1/g' inputfile
>
> Not sure why it is not doing it for newline character. May be it is
> very stupid mistake.
>
> Thanks
> VIJAY
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
>
More information about the Chicago-talk
mailing list