Re: Help with at Bash script

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



if i understood cerrectly,you need that:
domain=$(tcpdump -l -n -e port 53 | awk '{if ($14 ~ /A.*?/) print $15}')
while read line
do echo $line
done < $domain

On 3 December 2014 at 08:29, Hal Wigoda <hal.wigoda@xxxxxxxxx> wrote:

> What is domain, BTW?
>
> (Sent from iPhone, so please accept my apologies in advance for any
> spelling or grammatical errors.)
>
> > On Dec 2, 2014, at 12:05 PM, James B. Byrne <byrnejb@xxxxxxxxxxxxx>
> wrote:
> >
> > I am attempting to get a script borrowed from DJB to work on my
> CentOS-6.6
> > box.  Simplified it looks like this:
> >
> > tcpdump -l -n -e port 53 \
> >  | awk '{if ($14 ~ /A.*?/) print $15}' \
> >  | while read domain ; do echo $domain ; done ;
> >
> > The sticking point is the 'while read' construct.  Run just as 'tcpdum |
> awk'
> > I get this:
> >
> > english.stackexchange.com.
> > www.urbandictionary.com.
> > www.urbandictionary.com.
> > www.urbandictionary.com.
> > www.urbandictionary.com.
> > api.mywot.com.
> > a.udimg.com.
> > a.udimg.com.
> > fonts.googleapis.com.
> > . . .
> >
> > Run with the 'while read $domain ; do echo ' pipe nothing appears
> whatsoever.
> > What am I doing wrong?
> >
> > --
> > ***          E-Mail is NOT a SECURE channel          ***
> > James B. Byrne                mailto:ByrneJB@xxxxxxxxxxxxx
> > Harte & Lyne Limited          http://www.harte-lyne.ca
> > 9 Brockley Drive              vox: +1 905 561 1241
> > Hamilton, Ontario             fax: +1 905 561 0757
> > Canada  L8E 3C3
> >
> > _______________________________________________
> > CentOS mailing list
> > CentOS@xxxxxxxxxx
> > http://lists.centos.org/mailman/listinfo/centos
> _______________________________________________
> CentOS mailing list
> CentOS@xxxxxxxxxx
> http://lists.centos.org/mailman/listinfo/centos
>
_______________________________________________
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