if you are refreshing your Perl skill, please note the modern form of opening files using lexical filehandle instead of bareword ones:
open my $fh, '<', $filepath or die "could not open:$!";
Also if you use the low precedence or parens are unneeded.
If I understand your need your $find begins at 18 not 32:
Or if you want to use @F faciliy provided by -a Perl switch you can print element using negative indexes (because you have JOHN, DOE JR ie variable lenght fields)# warning windows doublequote perl -lanE "print $1 if /^.{17}(.*)/" datacolumn.txt HT000000000 123 50 70 80 H0000000000 123 50 70 80 HT000000000 123 50 70 80
perl -lanE "say join ' ',@F[-5,-4,-3,-2,-1]" datacolumn.txt HT000000000 123 50 70 80 H0000000000 123 50 70 80 HT000000000 123 50 70 80
Finally if you want to refresh your Perl Modern Perl is very worth a read and is free!
HtH
L*
In reply to Re: Copy Line After Skipping Columns -- oneliner
by Discipulus
in thread Copy Line After Skipping Columns
by jlope043
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |