Uma solução usando perl
:
Conteúdo de script.pl :
use warnings;
use strict;
## Acept one argumnet, the input file.
@ARGV == 1 or die qq[Usage: perl $0 input-file\n];
while ( <> ) {
## Remove last '\n' char.
chomp;
## Split line with string 'ASDFASDF22'
my @f = split /(ASDFASDF22)/;
## Print line but print first 49 chars plus a space of the special string.
printf qq[%s%-50s%s\n],
join( qq[], @f[0,1] ),
substr( $f[2], 0, 49 ) . qq[ ],
join( qq[], @f[3..$#f] );
}
Execute o script:
perl script.pl infile
E saída:
1653455 ASDFASDF22 bla bla bla asd xmv ASDFASDF22 AA
1944444 ASDFASDF22 klasdfmxvl yxklc erisa ask xdk asdm ase ASDFASDF22 BB
1984945 ASDFASDF22 jklyck aklsdfl asfjasl asdkkcii wdkkkxd aslasl w ASDFASDF22 BB