Re: Need help with awk one-liner

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



On Wed, Jul 09, 2008 at 12:13:13PM -0500, Sean Carolan wrote:
> The awk output that was piped into to the sed command looks like this:
> 
> ajpv12://host1.domain.company.com:8008/root
> ajpv12://host2.domain.company.com:8008/root
> ajpv12://host3.domain.company.com:8008/root

awk '/:8008\/root/ {printf "%s\t", gensub(/ajpv12:\/\/(.*):8008\/root/, "\\1", 1, $3) } END { printf "\n" }'

if you give an exact example of your input it would be easier but I
guess you can crunch the above example to do exactly what you want.

Match other ports and protocols:
awk '/:[[:digit]]+\/root/ {printf "%s\t", gensub(/\w+:\/\/(.*):[[:digit:]]+\/root/, "\\1", 1, $3) } END { printf "\n" }'

takes input:
foo bar URL baz

output:
URL\tURL\tURL\n

--
Fridh
_______________________________________________
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