10-18-2008, 02:13 AM
Here's one way to do it in Perl (there are many ways, most superior to this).
In the Terminal:
(First be sure we're in the Bourne shell, not csh or bash)
% sh
sh-3.2$
sh-3.2$ ( echo Location ; echo Inspections_Selected::Inspector ) | perl -e 'while ( <> ) {; print if s/(?:\b\w+::\b)?(.*)$/$1/; };'
Location
Inspector
sh-3.2$
Ugly. Sorry.
In the Terminal:
(First be sure we're in the Bourne shell, not csh or bash)
% sh
sh-3.2$
sh-3.2$ ( echo Location ; echo Inspections_Selected::Inspector ) | perl -e 'while ( <> ) {; print if s/(?:\b\w+::\b)?(.*)$/$1/; };'
Location
Inspector
sh-3.2$
Ugly. Sorry.