09-22-2008 06:08 AM
Now that I'v had coffee, this is much more consise:
# perl -ne 'print $_;print "INSERTED\n" if $. % 3 == 0' file
Should you desire to update in-place simply do:
# perl -ni.old -e 'print $_;print "INSERTED\n" if $. % 3 == 0' file
Your original 'file' will be preserved as 'file.old'.
09-22-2008 10:51 AM
Perl is not pre-installed in HP-UX by default, isn't it ?
09-22-2008 11:00 AM
> Perl is not pre-installed in HP-UX by default, isn't it ?
There should be a viable copy of Perl on your server even if it is a bit old. Find it with:
# whereis perl
09-22-2008 08:25 PM
>Could you please explain that?
It prints the current record. If the current input record number (NR) divided by 1000 has a remainder 0, then print out a separator.
09-23-2008 03:58 AM
> Sorry to say that ,we should not use perl commands in our scripts.
And just why would that be? The reason *can't* be portability since Perl has been ported to more platforms than most of us can even name:
To deny yourself the use of an extremely powerful tool is crippling at best. Assembly language, anyone?