[CentOS] script help - '3rd last field'

muhammad panji sumodirjo at gmail.com
Mon Jun 8 09:38:29 UTC 2009


On Mon, Jun 8, 2009 at 4:29 PM, Tom Brown<tom at ng23.net> wrote:
> Hi
>
> I need some logic to work out a value for me - this value is _always_
> the 3rd last field in a string seperated by '.' but the string could be
> 5 or 6 fields long, e.g
>
> foo.bar.VALUE.baz.lala
>
> foor.bar.gigi.VALUE.baz.lala
>
> I need to find VALUE - if this were python or something i could do it
> but this has to be in shell -


awk -F\. {'print $3'}
awk -F\. {'print $5'}
awk -F\. {'print $6'}



-- 
Muhammad Panji
http://sumodirjo.wordpress.com
http://www.kurungsiku.web.id



More information about the CentOS mailing list