Re: script help - '3rd last field'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Mon, Jun 8, 2009 at 5:29 AM, Tom Brown<tom@xxxxxxxx> 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 -
>
> Any clues?
>
> thanks
> _______________________________________________
> CentOS mailing list
> CentOS@xxxxxxxxxx
> http://lists.centos.org/mailman/listinfo/centos
>

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.

Jacques B.
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux