Finding last item in a line using grep
Here:
grep -o '[^,]\+$'
[^,]\+
matches one or more characters that are not,
at the end of the line ($
)-o
prints only the matched portion
Example:
% grep -o '[^,]\+$' <<<'Blah,3,33,56,5,Foo 30,,,,,,,3,Great Value'
Great Value
Always like to see an awk
solution so here it is (upvoted the proper solution!):
% awk -F, '{print $NF}' <<<'Blah,3,33,56,5,Foo 30,,,,,,,3,Great Value'
Great Value