in reply to Re: search and replace on a line by line basis
in thread search and replace on a line by line basis

that assumes that all lines in the file are of the format he describes. your example will pass through blank lines, for example. i believe he wants anything that is invalid filtered.

perl -e'$_="nwdd\x7F^n\x7Flm{{llql0}qs\x14";s/./chr(ord$&^30)/ge;print'

  • Comment on Re: Re: search and replace on a line by line basis

Replies are listed 'Best First'.
Re: Re: Re: search and replace on a line by line basis
by gsiems (Deacon) on Apr 15, 2004 at 21:11 UTC
    Good point.

    How about:

    perl -lne 'next if /^.{188}0{8}.{16}$/; print if s/^(.{188})\d{8}(. +{16})$/${1}20020101$2/' original.txt > new.txt