I have a file with multiple fields; 2 | foo | bar 4 | bar | foo 1 | bar | foo 3 | foo | bar My goal is to sort the first field numerically and print the first field of the last result. awk -F"|" '/foo/ {print $1 | "sort"}' awk -F"|" '/foo/ {number=$1} END {print version}' Help is greatly appreciated :) SDA -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mailman.mn-linux.org/pipermail/tclug-list/attachments/20151030/83de83a7/attachment.html>