From: Christopher Vance (firstname.lastname@example.org)
Date: Wed May 03 2006 - 01:20:36 CST
On Wed, May 03, 2006 at 06:47:56AM +0200, Philippe Verdy wrote:
>I just want to be able to match for example "aaaaa\nbbbbbb" and replace it with anything,i.e. not having to play with the ''vi'' join and merge commands; to match "aaaa" and replace it with "ccccccc\ndddddddd".
>The later is possible with a sed script using a loop, but the first case requires (with vi or sed) first substituting allnewlines by some unique character like '?' (using "tr" for example), provided that I'm sure this '?' substitution character is not present in the whole text, and then I can usesearch/replace patternsusing this unique character, then I have to translate again this '?' into newlines (using tr).
>Such thing is very common when I need to make search/replace operations in XML files with the usual indentation, because search patterns are contextual and include acontext in the previous or next lines. Nut it happens all times when I work on delimited datafiles (notably those that come from database exports and that will beimported into another system).
>These plain text files can be very huge, and having to write a special program to filter them is a constant nightmare, notably when such edits is to be performed only once (and its cost with manual edit is too large, and very boring or errorprone to do manually).
The text editor 'sam' works fine with multiline regexps. Available on
Plan9, V10 Unix, *BSD, Linux, etc. Maybe even Windows. Last time I
looked it used an older specification of Unicode.
-- Christopher Vance
This archive was generated by hypermail 2.1.5 : Wed May 03 2006 - 01:23:39 CST