The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 05-26-2009
summer_cherry summer_cherry is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2007
Location: Beijing China
Posts: 1,088
Code:
sub scrub{
	my($pos,$len)=(@_);
	while(<DATA>){
		substr($_,$pos-1,$len) =~ y/12345/67890/;
		print $_;
	}
}
scrub(6,3);
__DATA__
1234,5678,0987,12345667,000000976655,+1234,013994878356
0987,23467,11243554,0000887651,1234567,09876,1234455
0987,1223443,797784784784,09866545,+232322,097865