Shell Script: split string tr and awk








# the string is dot separated.
a=1a.2b.3c.4d.5e.6f

# split it and prints 6th column
echo $a | tr "\." "\ " | awk '{print $6}'

# prints 6f


See Also: Shell Script: split string using cut


No comments:

Post a Comment