On Tue, May 27, 2003 at 05:28:56PM -0500, Aaron Stout wrote:
> Hi.
>
> I am trying to wright a quick script to get DNS nameserver entries from
> dhcpd. While the script I have wrote works i would like to see how it
> could be done with grep, awk or sed. Here is what I have.
>
> #!/bin/sh
>
> DNSSERVERS=`grep DNS /home/aaron/scripts/dhcpcd-eth0.info`
> LIST=${DNSSERVERS//,/ }
> newList=${LIST//DNS=/ }
>
> for serv in $newList; do
> echo "nameserver $serv"
> done
>
> Thanks
> --
> Aaron
Try this:
#!/bin/sh
grep '^DNS=' /home/Aaron/scripts/dhcpcd-eth0.info | sed 's/DNS=/nameserver /'
--
Richard Kilgore
[EMAIL PROTECTED]
--
[EMAIL PROTECTED] mailing list