Checking required columns in the file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Checking required columns in the file
# 1  
Old 11-02-2011
Checking required columns in the file

Hi,

File contains with TAB delimeter file,i want check the 2,3 are not null
Code:
test1@gmail.com  100 test
test2@gmail.com  101 test 
test3@gmail.com   test 
test4@gmail.com 102

OUTPUT
Code:
test1@gmail.com  100 test
test2@gmail.com  101 test

Please help me with one single command in unix.

Thanks,
Murali


Moderator's Comments:
Mod Comment Please use code tags <- click the link!

Last edited by zaxxon; 11-02-2011 at 09:44 AM.. Reason: code tags, see PM
# 2  
Old 11-02-2011
Quote:
awk 'NF==3 {print}' <infile
# 3  
Old 11-02-2011
Thanks for reply...
this output,how can save into another file.

---------- Post updated at 07:49 AM ---------- Previous update was at 07:44 AM ----------

Below record contains one tab,this also displaying,i dont' want record..

Code:
test4@gmail.com|102|test1|test2 test3

---------- Post updated at 08:01 AM ---------- Previous update was at 07:49 AM ----------

Hey guys please help me ...

---------- Post updated at 08:08 AM ---------- Previous update was at 08:01 AM ----------

Sorry now it's working. Please help how to load the ouputput data.

---------- Post updated at 08:09 AM ---------- Previous update was at 08:08 AM ----------

Got it ... Lot of thanks to Gowtham...

Last edited by zaxxon; 11-02-2011 at 10:16 AM.. Reason: code tags, bumping up
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to print multiple required columns dynamically in a file using the header name?

Hi All, i am trying to print required multiple columns dynamically from a fie. But i am able to print only one column at a time. i am new to shell script, please help me on this issue. i am using below script awk -v COLT=$1 ' NR==1 { for (i=1; i<=NF; i++) { ... (2 Replies)
Discussion started by: balu1234
2 Replies

2. UNIX for Dummies Questions & Answers

Best Alternative for checking input parameter contains required value or not

Any good way to check if code has the required output # /sbin/sysctl net.ipv4.icmp_echo_ignore_broadcasts net.ipv4.icmp_echo_ignore_broadcasts = 1 /sbin/sysctl net.ipv4.icmp_echo_ignore_broadcasts | grep "= 1" net.ipv4.icmp_echo_ignore_broadcasts = 1 What I can think of is above, and it... (16 Replies)
Discussion started by: alvinoo
16 Replies

3. Shell Programming and Scripting

Checking the CSV File Columns

Hi All, i have a CSV file like below, col1 col2 col3 col4 col5 col6 col7 a1 a2 a3 a4 a5 a6 a7 b1 b2 b3 b4 b5 b6 b7 c1 c2 c3 c4 c5 c6 c7 d1 d2 d3 d4 d5 d6 d7 Col1,col2.. are the column names and... (1 Reply)
Discussion started by: dileep_d10
1 Replies

4. Shell Programming and Scripting

Required help to print diff columns for 2 patterns using awk

Hi All, I need help for below scenario : I have a principals.xml_24092012backup file : cat principals.xml_24092012backup </user> <user username="eramire" password="2D393C01720749256303D204826A374D9AE9ABABBF8A"> <roleMapping rolename="VIEW_EVERYTHING"/> </user> ... (2 Replies)
Discussion started by: kiran_j
2 Replies

5. Shell Programming and Scripting

Checking for ranges based on 2 columns

Hi, I have a file with 6 columns. I want to check if column 1 and 2 fall between column 5 and 6 I want to call them as "TRUE_genes" if not then call them as "FALSE_genes". I can do it for checking one column but how to mention about two columns. file1 110371373... (1 Reply)
Discussion started by: Diya123
1 Replies

6. Shell Programming and Scripting

Checking the required columns in File

Hello Experts, File contains 10 columns with | delimeter. 1,3,4,5,7,9 columns are required columns means it should contains values. i need those records, rest of it will contain or not contain data. test1.txt: a@a.com|a|b|c|d|e|f|g|h|i |a|b|c|d|e|f|g|h|i b@b.com|a||c|d|e|f|g|h|i... (7 Replies)
Discussion started by: muralikri
7 Replies

7. Shell Programming and Scripting

Checking the case of columns

Hi, Is there a function in awk or sed which will check the case of the columns. If my column 8 is in lower case then I want to change my column 10 data in lower case and vice versa. I know in awk we have tolower and toupper functions but can we manipulate the data based on the case ?? ... (3 Replies)
Discussion started by: mora
3 Replies

8. Shell Programming and Scripting

Getting required fields from a test file in required fromat in unix

My data is something like shown below. date1 date2 aaa bbbb ccccc date3 date4 dddd eeeeeee ffffffffff ggggg hh I want the output like this date1date2 aaa eeeeee I serached in the forum but didn't find the exact matching solution. Please help. (7 Replies)
Discussion started by: rdhanek
7 Replies

9. Shell Programming and Scripting

grep required data from two columns

hello, I have output from a command and I need to filter some info out of that. I tried awk command but I can not grep what I am looking for: Following is the output and I need to capture "disabled" for each volume from first column and report: # vol status Volume State ... (2 Replies)
Discussion started by: za_7565
2 Replies

10. Shell Programming and Scripting

shell script required to convert rows to columns

Hi Friends, I have a log file as below siteid = HYD spc = 100 rset = RS_D_M siteid = DEL spc = 200 rset = RS_K_L siteid = DEL2 spc = 210 rset = RS_D_M Now I need a output like column wise as below. siteid SPC rset HYD 100 RS_D_M (2 Replies)
Discussion started by: suresh3566
2 Replies
Login or Register to Ask a Question