Saravana Kumar wrote: > John W. Krahn wrote: > >>You can do what you want if you set the Input Record Separator to read >>1000 bytes at a time: >> >>$/ = \1000; >>while ( <FILE> ) { >> s/[[:cntrl:]]/ /g; >> print "$_\n"; >> } > > Thanks John. That did the trick. I ran the above script with my input file > and redirected the output to another file. Since it is creating a new file > i was wondering whether i can do the changes in the same file ie., read > 1000 characters, do the replacement and write the output to the same file. > This will reduce the disk space used(since the file i have is 100G).
Because you are adding characters (the newline) about the only way to do what you want is to read the entire file into memory, modify it, and then write it back out to the same file. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>