Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Markus Elfring Newsgroups: comp.unix.programmer Subject: Re: Escaping of line breaks for text replacement Date: Mon, 03 Mar 2014 08:38:50 +0100 Lines: 15 Message-ID: <5314318A.7010806@web.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Trace: individual.net 82WBYedlhmI8D3n9LpvuTgut27e3CkAFRZ9FHh1z0hKaiy7tl2 Cancel-Lock: sha1:8eMGFr+VliIO79LfhcgS0obDzfk= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: Xref: csiph.com comp.unix.programmer:5161 > XY=`sed ':a;N;$!ba;s/\n/\\\n/g' $INPUT` > > you set XY to the files contents with linefeeds replaced by > '\\n' which is then acceptable to sed. Thanks for your suggestion. I would prefer to perform such a search and replace operation for newlines by the functionality "shell pattern substitution" instead of calling another program. I am going to put a command variant into a make file so that I'm also interested in considerations for relevant run time differences in the discussed approaches. Regards, Markus