Depends on what the lines actually look like, check man/info
pages but you  could

Try  cut -f1 filename | sort | uniq

you need to sort it first prior to UNIQ.


>  -----Original Message-----
>  From: [EMAIL PROTECTED]
>  [mailto:[EMAIL PROTECTED] Behalf Of Barry
Johnson
>  Sent: Wednesday, July 30, 2003 2:31 PM
>  To: [EMAIL PROTECTED]
>  Subject: RE: Print the first column of a file
>
>
>  Awk is something that you could you
>
>  More $filename|awk '{print $1}'|uniq  will sort through
the file and
>  print the first column
>
>  -----Original Message-----
>  From: [EMAIL PROTECTED]
>  [mailto:[EMAIL PROTECTED]
>  On Behalf Of Mark Neidorff
>  Sent: Wednesday, July 30, 2003 9:48 AM
>  To: [EMAIL PROTECTED]
>  Subject: Re: Print the first column of a file
>
>
>  On Tue, 29 Jul 2003, 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 :)
>  >
>  > Thanks for any help.
>  > RDB
>  >
>
>  Take a look at the 'cut' command.
>
>  Mark
>
>
>  --
>  redhat-list mailing list
>  unsubscribe
mailto:[EMAIL PROTECTED]
>  https://www.redhat.com/mailman/listinfo/redhat-list
>
>
>  --
>  redhat-list mailing list
>  unsubscribe
mailto:[EMAIL PROTECTED]
>  https://www.redhat.com/mailman/listinfo/redhat-list
>


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to