LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-08-2010, 01:50 AM   #1
Jason7449
LQ Newbie
 
Registered: Mar 2010
Posts: 8

Rep: Reputation: 0
Question 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!
 
Old 03-08-2010, 02:54 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
For the first question something like
Code:
cat input.txt | awk '{print $1}' | sort | uniq -d
 
Old 03-08-2010, 08:53 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,550

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

For number 2

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

Last edited by grail; 03-09-2010 at 02:52 AM. Reason: Update as SOLVED
 
Old 03-08-2010, 10:36 AM   #4
Jason7449
LQ Newbie
 
Registered: Mar 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Thank you soooo much guys!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Needed - How to count an item in a tab-delimited txt file? Jason7449 Linux - Newbie 3 03-07-2010 10:20 AM
searching pattern in tab delimited file using grep vaibhavs17 Programming 5 03-05-2010 02:02 AM
column re-alignment - space delimited to comma delimited hattori.hanzo Linux - Newbie 9 03-05-2009 01:54 AM
Parsing a tab delimited text file jajanes Programming 9 08-08-2003 11:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration