Re: How to concatenate lines continued with '\'?

From: Dan Mercer (dmercer_at_mn.rr.com)
Date: 04/14/04

  • Next message: Bill Marcum: "Re: pipe question"
    Date: Wed, 14 Apr 2004 16:56:11 GMT
    
    

    "Heiner Steven" <heiner.steven@nexgo.de> wrote in message news:407c5449$0$20557$9b4e6d93@newsread4.arcor-online.net...
    : I'm searching for the fastest and shortest way to
    : concatenate lines continued with a backslash as
    : a last character.
    :
    : Example:
    :
    : this is a \
    : continued \
    : line
    :
    : should be converted to
    :
    : this is a continued line
    :
    It's kinda funny that no one in comp.unix.shell suggested a shell
    answer:

    In Ksh

        while IFS= read line
            do
            print -n -- "$line"
            done < infile >outfile

    In bash replace print with the appropriate echo statement.

    I haven't tested with indented lines, but in that case you would
    just add a "-r" to the read.

    Dan Mercer


  • Next message: Bill Marcum: "Re: pipe question"

    Relevant Pages