[CentOS] script help - '3rd last field'
Tom Brown
tom at ng23.net
Mon Jun 8 09:51:00 UTC 2009
> I am pretty sure there is a way in awk to figure out how many fields
> you have, then take the total # of fields -3 each time to get the
> third last one. Just heading out the door and off hand can't remember
> how it would be done.
>
>
i can do it in cheetah templating with
set myloc = $getVar("hostname","")split('.')[-3]
the -3 says the last 3rd field in the string - i need the same so maybe
awk can do this
More information about the CentOS
mailing list