Re: More awk help

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



Joseph L. Casale wrote:
> Hey guys,
> Looking through my book and the web and I am not having any success
> returning data from a search.
> 
> I need to have awk search for a string and print the first field which
> is no problem but now its returning two options as the input data has
> changed. The change is reliable, I only want the first field if it ends
> in a regex that I have, and I only want what that regex matches to be
> printed. Is it possible to do this in a one liner so I don't need to
> construct an awk script?
> 
> I suppose I could pipe it into grep and cut but that's not very sexy :)

Sed is the next tool up from grep:

sed -n -e 's/.*\(regex\.*)/\1/p'
will print the matching regex, so if you can expand it to match whatever 
you are calling a field it should work.

-- 
   Les Mikesell
    lesmiksell@xxxxxxxxx

_______________________________________________
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