Request to check:remove entries with N/A entries


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Request to check:remove entries with N/A entries
# 1  
Old 05-07-2012
Request to check:remove entries with N/A entries

Hi

I have a file with numerous entries some entries are

Code:
1    mani
2    kavya
3    N/A
4    Praveeen
5    N/A

and so on


How to remove entries with N/A so the result will be

Code:
1    mani
2    kavya
3    Praveeen


Please let me know I m using Unix shell so whether I can do by Unix commands or Perl script any kind of help will be appreciated

Thanks
Mani

Last edited by Scrutinizer; 05-07-2012 at 07:59 AM.. Reason: code tags
# 2  
Old 05-07-2012
Code:
awk '$2!="N/A"' infile > outfile

# 3  
Old 05-07-2012
Code:
awk '$2!="N/A" {print ++i,$2}' OFS='\t' infile

# 4  
Old 05-07-2012
Code:
# awk 'BEGIN{OFS="    "}NR==1{x=$1};$2!="N/A"{print x++,$2}' infile

# 5  
Old 05-07-2012
Thanks for the reply

Kindly let me know if the file contains more than one column and the N/A is given in the 2 or 3 or 4 column. then hw to remove all those rows which contan N/A in 2 or 3 or 4 columns.

for eg.
Quote:
name1 123

name 2 N/A

name 3 1234 N/A

Name 4 N/A 4567

name5 4567 e46456

And I need the output file

Quote:
name1
name5
bcause there is no entries related to N/A


Thanks
Mani Grover
# 6  
Old 05-08-2012
Code:
 
sed '/N\/A/d' filename | awk '{print $1}'

# 7  
Old 05-08-2012
Quote:
Originally Posted by manigrover
Thanks for the reply

Kindly let me know if the file contains more than one column and the N/A is given in the 2 or 3 or 4 column. then hw to remove all those rows which contan N/A in 2 or 3 or 4 columns.

for eg.



And I need the output file



bcause there is no entries related to N/A


Thanks
Mani Grover
Code:
# awk '!/N\/A/&&!/^ *$/{print $1}' file
name1
name5

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Request to check:Fetch certain entries

Hi all. Kindly check it it's urgent!! I have one big file from which which I have to fetch certain data I have attached a small part of this file. from the attached file, I have to fetch and arrange data in 3 columns 1 Generic name 2. Brand names 3. Drug... (10 Replies)
Discussion started by: manigrover
10 Replies

2. Shell Programming and Scripting

Request to check:remove entries with duplicate numbers in first row

Hi I have a file 1 xyz 456 1 xyz 456 1 xyz 456 2 abc 8459 3 gfd 657 4 ghf 658 4 ghf 658 I want the output 1 xyz 456 2 abc 8459 3 gfd 657 4 ghf 658 (3 Replies)
Discussion started by: manigrover
3 Replies

3. Shell Programming and Scripting

Extract certain entries from big file:Request to check

Hi all I have a big file which I have attached here. And, I have to fetch certain entries and arrange in 5 columns Name Drug DAP ID disease approved or notIn the attached file data is arranged with tab separated columns in this way: and other data is... (2 Replies)
Discussion started by: manigrover
2 Replies

4. Shell Programming and Scripting

Request to check:count specific entries

Hi all I have an input file which contains so many entries like this: And, I want to count hw many among ASN in one column are converted to LYS in third coulmns. which means output shuld contain only "ASN number LYS" Kindly let me know wny programm for this My input is ASN 217 LYS... (2 Replies)
Discussion started by: manigrover
2 Replies

5. Shell Programming and Scripting

Request to check: Not printing all entries

Dear all, I am facing one problem in my input file there are many Entries which starts from *FIELD * AV (checked the attached file) I want all the entries in the output file which start from *FIELD * AV I have written this programm but its not printing all the entries with *FIELD... (4 Replies)
Discussion started by: manigrover
4 Replies

6. Shell Programming and Scripting

Request to check:remove entries more than once in different column

Hi I have a file 12m 345693460 12 1234 12 1234 34 345 34 345 And I want output fiel as 12m 345693460 12 1234 34 345 hw can it be done Thanks (1 Reply)
Discussion started by: manigrover
1 Replies

7. Shell Programming and Scripting

Request to check:remove entries with N/A mentioned

Hi I have a file with following entries 122 N/A 123 5654656 123423 43534543 4544 45435 435454 N/A i Have to remove entries with N/A so that only 123 5654656 123423 43534543 4544 45435 remain in output file can anybody guide for a code/unix/perl (2 Replies)
Discussion started by: manigrover
2 Replies

8. Shell Programming and Scripting

Request to check:remove entries with blank spaces

Hi I want to remove entries with blank spaces in my input file: 123 234 456 678 56789 345346456 589 3454 345456 3454566............................ (2 Replies)
Discussion started by: manigrover
2 Replies

9. Shell Programming and Scripting

Request to check:remove entries more than once

Hi I have a file like this 1234 2345 567889 567889 2345 234899420 83743 2345 67890 67890 ................ so on I want to delete entries which are more than once like 2345, 567889 and 67890 so that these appear once (4 Replies)
Discussion started by: manigrover
4 Replies

10. Shell Programming and Scripting

Request to check:find out common entries

I have to compare 2 files which means 2 files with common entries in same column and separate those common entries in a diferent file as well right before those entries common so that I can separat common and Uncommon entries in rows in 2 different files. Is it possible For eg. one file ... (3 Replies)
Discussion started by: manigrover
3 Replies
Login or Register to Ask a Question