Help with replacing string

Hi All,

I have below requirement:

I need to read each line in file.txt and replace string starting from position 9 to 24 {111111111111111,222222222222222,333333333333333} by common string "444444444444444" and save file.

File.txt:

03000003111111111111111 xxxxxx0000150000+0408110512289030680522 xxxxxx
03000004222222222222222 xxxxxx0000299700+0408110112207038359159 xxxxxx
03000005333333333333333 xxxxxx0000079900+0408110615207038381868 xxxxxx

Please help.Thanks in advance.

sed 's/\(........\).............../\14444444444444444/' file.txt >fltmp
mv fltmp file.txt

Thaks.It worked.:slight_smile:

Hi,

$ perl -pe 'substr( $_, 8, 24-8, "4" x (24-8))' infile
030000034444444444444444xxxxxx0000150000+0408110512289030680522 xxxxxx                                                                                                                                                                       
030000044444444444444444xxxxxx0000299700+0408110112207038359159 xxxxxx
030000054444444444444444xxxxxx0000079900+0408110615207038381868 xxxxxx

Regards,
Birei