Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by pizza_milkshake (Monk)
on Apr 15, 2004 at 17:39 UTC ( [id://345468]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://345468]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2024-04-19 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found