Also, 'cut' is made for this sort of thing...
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 29, 2003 1:52 PM
To: [EMAIL PROTECTED]
Subject: Re: Print the first column of a file
Am Dienstag, 29. Juli 2003 15:58 schrieb Jason Dixon:
> On Tue, 2003-07-29 at 10:07, Reuben D. Budiardja wrote:
> > Hello,
> > What command would I use to print just the first column of a file?
> > For example, the httpd (apache) access_log. The first column
> > contains the IP address. How can I just output that, so that I can
> > then pass it to "uniq" to get the uniques IP addresses that
> > requested a page from my server?
> > Like:
> >
> > $> <command> | uniq
> >
> > Does this use something like 'sed' or 'gawk'? I need to learn how to
> > use those anyways :)
>
> Yes.
>
> $ cat /var/log/httpd/access_log | awk '{print $1}' | sort | uniq
..useless use of cat:
awk '{print $1}' /var/log/httpd/access_log | sort | uniq
is enough.
Christian Paul
--
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list