I need to find the last column from a variable that contains some fields. I need to write something like:
if [ #the last column = "R" ];
then
value=`echo "'$value'"`
fi
Is it possible?
More universal code assuming separation by spaces:
case $var in
(*\ R) printf "%s\n" "$var"
esac
Or:
if [ "${var##* }" = R ]; then
printf "%s\n" "$var"
fi