RE: Need help with awk one-liner

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



Sean Carolan wrote:

> This awk command pulls URLs from an apache config file, where $x is
> the config filename.
> 
> awk '/:8008\/root/ {printf $3 "\t"}' $x
> 
> The URL that is output by the script looks something like this:
> 
> ajpv12://hostname.network.company.com:8008/root
> 
> Is there a way to alter the output so it only shows "hostname" by
> itself?  Do I need to pipe this through awk again to clean it up?

awk '/:8008\/root/ {printf $3 "\t"}' $x | sed 's/.*\/\(.*\):.*/\1/'

-Ross

______________________________________________________________________
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.

_______________________________________________
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