in reply to What is the fastest way to extract data from a delimited string?


You could write this as a simple one-liner as follows, see perlrun for an explanation of the command line options:     perl -lane 'print $F[5]' file

Or to get the sixth column only if there is one:

perl -lane 'print $F[5] if @F > 5' file perl -lane 'print $F[5] if defined $F[5]' file

You can also specify a delimiter pattern using the -F flag. Here is an example for *simple* comma separated data:     perl -F, -lane 'print $F[5]' file

There is also the Unix cut utility and the modules Text::CSV_XS and Text::xSV.

And finally, since perl -lane is just a synonym fo awk: ;-)     awk '{print $6}' file

--
John.