Unix shell question.

Discussion in 'OT Technology' started by zanyspy_dude, Feb 29, 2008.

  1. zanyspy_dude

    zanyspy_dude King of teh n00bz

    Joined:
    Aug 29, 2002
    Messages:
    4,473
    Likes Received:
    0
    Location:
    Indianapolis, IN
    I have a text file that is tab delimited. How do I output only the second column to stdout? I wrote the c version, now i need the shell version :(

    I tried google but came up with nothing, but don't worry; I'm dropping out after you answer my question :p
     
  2. zanyspy_dude

    zanyspy_dude King of teh n00bz

    Joined:
    Aug 29, 2002
    Messages:
    4,473
    Likes Received:
    0
    Location:
    Indianapolis, IN
    the answer is!!

    cat filename | awk '$2 { print $2 }' | sort | uniq | wc -l
     
  3. trouphaz

    trouphaz New Member

    Joined:
    Sep 22, 2003
    Messages:
    2,666
    Likes Received:
    0
    uh, that's not the answer to your own question. it would just be:

    cat <filename> | awk '{print $2}'

    the rest of that is going to give you the number of uniq entries in column 2.
     
  4. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    I her perl is god t this.
     
  5. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    lol drinking and posting
     
  6. zanyspy_dude

    zanyspy_dude King of teh n00bz

    Joined:
    Aug 29, 2002
    Messages:
    4,473
    Likes Received:
    0
    Location:
    Indianapolis, IN
    well, i answered the whole question that was my assignment. IT was just the first part that i was stuck on.


    @peyomp
    I love the drunken post btw.
     

Share This Page