Date: Tue, 5 Feb 2002 13:31:43 -0800 From: "Crist J. Clark" <cristjc@earthlink.net> To: Angela Yu <angelaoyu@hotmail.com> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: [Unix shell script] Message-ID: <20020205133143.C368@gohan.cjclark.org> In-Reply-To: <F83XQ3S2vUSW10Yhmvv00006e9c@hotmail.com>; from angelaoyu@hotmail.com on Tue, Feb 05, 2002 at 06:31:53PM %2B0000 References: <F83XQ3S2vUSW10Yhmvv00006e9c@hotmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Feb 05, 2002 at 06:31:53PM +0000, Angela Yu wrote:
> Greetings.
>
> I am interested in knowing the shell script that can remove the subdomain
> part of all FQDN in a input file, have domain name sorted and send the list
> to a new output file.
>
> Example:
> Input File -
> www.hotmail.com
> mail.yahoo.com
> ftp.yahoo.com
> mail.hotmail.com
> www.computer.com.uk
>
> Output File-
> computer.com.uk
> hotmail.com
> hotmail.com
> yahoo.com
> yahoo.com
It's trivial with cut(1), sed(1), awk(1), and perl(1). But if you
really want to use sh(1)... it is also trivial,
for read HOST; do
echo "${HOST#*.}"
done < input.file
--
Crist J. Clark | cjclark@alum.mit.edu
| cjclark@jhu.edu
http://people.freebsd.org/~cjc/ | cjc@freebsd.org
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020205133143.C368>
