LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help needed - How to check quality of a specific column in a tab-delimited file? (https://www.linuxquestions.org/questions/linux-newbie-8/help-needed-how-to-check-quality-of-a-specific-column-in-a-tab-delimited-file-793888/)

Jason7449 03-08-2010 12:50 AM

Help needed - How to check quality of a specific column in a tab-delimited file?
 
Hi guys, could anyone please provide me the shell commands for such two goals?

In a tab-delimited file,
Code:

1        a        I        a        11        a        a
2        b        II        a        22        a        a
1        c        III        a        abc        a        a
4        d        IV        a        abc        a        a

1. How can I find the non-unique values in the 1st column (1, in this case)?

2. How can I find the non-integer values in the 5th column (abc, in this case)?

Thank you sooooo much for your help!

catkin 03-08-2010 01:54 AM

For the first question something like
Code:

cat input.txt | awk '{print $1}' | sort | uniq -d

grail 03-08-2010 07:53 AM

awk '$5 !~ /[0-9]+/ { print $0 }' in.txt

For number 2

Don't forget to mark as SOLVED if your problem has been resolved.

Jason7449 03-08-2010 09:36 AM

Thank you soooo much guys!


All times are GMT -5. The time now is 08:47 PM.