RE: Print the first column of a file

amead_at_aicpa.org
Date: 07/29/03

  • Next message: John McKinney: "Re: List has died!"
    To: redhat-list@redhat.com
    Date: Tue, 29 Jul 2003 15:49:57 -0400
    
    

    Also, 'cut' is made for this sort of thing...
    -----Original Message-----
    From: redhat-list-admin@redhat.com [mailto:redhat-list-admin@redhat.com]

    Sent: Tuesday, July 29, 2003 1:52 PM
    To: redhat-list@redhat.com
    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:redhat-list-request@redhat.com?subject=unsubscribe
    https://www.redhat.com/mailman/listinfo/redhat-list
    

  • Next message: John McKinney: "Re: List has died!"

    Relevant Pages

    • RE: Print the first column of a file
      ... > On Behalf Of Mark Neidorff ... >> What command would I use to print just the first column ... > Take a look at the 'cut' command. ...
      (RedHat)
    • Re: sort_by: multiple fields with reverse sort
      ... would be efficient for large enough lists to outperform more tedious ... but it would be even better if Ruby natively supported it. ... end.collect do |kv| # Return the items in key sort order. ... # column and in reverse on the first column. ...
      (comp.lang.ruby)
    • RE: Report in Certain Order
      ... Thanks again OssieMac for your patience, ... Drag the field into the first column of the matrix. ... DO NOT set the sort for this column. ... Close the close X to close the query builder and select save at the prompt. ...
      (microsoft.public.access.gettingstarted)
    • RE: Report in Certain Order
      ... first column and the primary and secondary sorts in the correct order from ... Drag the field into the first column of the matrix. ... DO NOT set the sort for this column. ... Close the close X to close the query builder and select save at the prompt. ...
      (microsoft.public.access.gettingstarted)
    • Re: sort and matching cells
      ... sort the first column. ... Use a second range object to point to the first cell in column B then ... if they don't match insert cells moving rows down(again a record macro ... sort the first column and use a vlookup to match the other valuse ...
      (microsoft.public.excel.programming)