Link to home
Start Free TrialLog in
Avatar of isaacr25
isaacr25

asked on

Perl script modification

Ok,
I have the following perl command:

perl -pe "s/^(.{9}).{7}(.*)/0000000$1$2/" formatted.txt > output.txt

This command takes the first 9 characters, moves them over 7 characters, and fills the voided 7 spaces with zeros. I've just been notified that this requirement has changed, and so I need to change the command just a bit.

The new requirement: The first 9 characters need to be shifted 6 characters to the right, instead of 7. Additionally, one zero needs to be added to the end of the 9 character string. I would imaging that shifting the 9 character string only 6 spaces would be achieved by this:

perl -pe "s/^(.{9}).{6}(.*)/0000000$1$2/" formatted.txt > output.txt

Is this correct, and if so, how do I then add the trailing zero to the end of the shifted 9 characters string.?Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Adam314
Adam314

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial