in reply to Search and replace text
This assumes that your sample data is a true reflection of it. Ie. Fixed length records of 12 chars + newline.
Update: Removed redundant regex.
#! perl -sw use strict; $/ = \39; ## Read 3 lines as a single record while( <DATA> ) { my $rep = sprintf '%02d', int rand 100; substr $_, 0, 2, $rep; substr $_, 14, 2, $rep; substr $_, 27, 2, $rep; print; } __DATA__ 57KXNWLRZWJ3 057E8bf0D030 057E8bf0D032 58KXNWLRZWKB 058E8bf0D02A 058E8bf0D02C
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Search and replace text
by ikegami (Patriarch) on Jan 26, 2006 at 23:31 UTC | |
by BrowserUk (Patriarch) on Jan 26, 2006 at 23:53 UTC |