Hi Team,
How to get the last 3 characters of a String irrespective of their length using awk?
Thanks
Kinny
Hi Team,
How to get the last 3 characters of a String irrespective of their length using awk?
Thanks
Kinny
An example for the first field:
awk '{print substr($1,length($1)-2)}'
$string="hello"
sed 's/.*\(.\{3\}\)$/\1/' <<< $string
You can use the above sed command also.
This will print "llo".
string="welcome"
echo ${string:(-3)}
The output is
ome
That worked like a charm. Thanks a Ton
awk -F "" '{print $(NF-2)$(NF-1)$NF}'