Match the word or words and fetch the entries


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Match the word or words and fetch the entries
# 8  
Old 08-07-2012
Change
Code:
}' OFS='\t' lookupfie sarattdnewdruggene4.txt >sarattdnewdruggene5.txt

to
Code:
}' OFS='\t' lookupfie sarattdnewdruggene4.txt

The required files will get generated in your current directory.
# 9  
Old 08-07-2012
Thankyou very much.

It was immensely helpful.

Now, in other file

these 7 names are present in starting from 3rd column and then in 1 column after that

means the file contain these 7 words in coulmns 3,5,7,9,11,13,15,17,19 ........

It's a big file in terms of columns not rows.

Whether we can change some thing so that it will do the the same thing here as well means if our input is

Quote:
CFB 4-Guanidinobenzoic Acid Not Available T1D
CTSD 1h-Benoximidazole-2-Carboxylic Acid Not Available T2D N-Aminoethylmorpholine Not Available T2D 5-AMINO-6-CYCLOHEXYL-4-HYDROXY-2-ISOBUTYL-HEXANOIC ACID Not Available T2D
TLL2 Carbobenzoxy-Pro-Lys-Phe-YPo2-Ala-Pro-Ome Not Available T2D
AGTR1 Valsartan Diovan CAD,HT,HT,CD,CD,CD,CD,RA,RA Olmesartan Benicar CAD,HT,HT,CD,CD,CD,CD,RA,RA Losartan Cozaar CAD,HT,HT,CD,CD,CD,CD,RA,RA Candesartan Amias CAD,HT,HT,CD,CD,CD,CD,RA,RA Eprosartan Teveten CAD,HT,HT,CD,CD,CD,CD,RA,RA Forasartan Not Available CAD,HT,HT,CD,CD,CD,CD,RA,RA Saprisartan Not Available CAD,HT,HT,CD,CD,CD,CD,RA,RA
CTSG Bis-Napthyl Beta-Ketophosphonic Acid Not Available RA
RXRB 6-1-3,5,5,8,8-Pentamethyl-5,6,7,8-Tetrahydronaphthalen-2-YlCyclopropylPyridine-3-Carboxylic Acid Not Available T1D
TYR Monobenzone AgeRite Alba T2D
HSD11B1 3,3-dimethylpiperidin-1-yl6-3-fluoro-4-methylphenylpyridin-2-ylmethanone Not Available T2D,RA 5S-2-1S-1-4-fluorophenylethylamino-5-1-hydroxy-1-methylethyl-5-methyl-1,3-thiazol-45H-one Not Available T2D,RA 2R-1-4-tert-butylphenylsulfonyl-2-methyl-4-4-nitrophenylpiperazine Not Available T2D,RA 2-6-3-chloro-2-methylphenylsulfonylaminopyridin-2-yl-N,N-diethylacetamide Not Available T2D,RA 5S-2-1S-1-2-fluorophenylethylamino-5-methyl-5-trifluoromethyl-1,3-thiazol-45H-one Not Available T2D,RA N-1-1-carbamoylcyclopropylmethylpiperidin-4-yl-N-cyclopropyl-4-1S-2,2,2-trifluoro-1-hydroxy-1-methylethylbenzamide Not Available T2D,RA N-cyclopropyl-N-trans-4-pyridin-3-ylcyclohexyl-4-1S-2,2,2-trifluoro-1-hydroxy-1-methylethylbenzamide Not Available T2D,RA 1-3R-3-methyl-4-4-1S-2,2,2-trifluoro-1-hydroxy-1-methylethylphenylsulfonylpiperazin-1-ylmethylcyclopropanecarboxamide Not Available T2D,RA 5S-2-cyclooctylamino-5-methyl-5-propyl-1,3-thiazol-45H-one Not Available T2D,RA 2-2-CHLORO-4-FLUOROPHENOXY-2-METHYL-N-1R,2S,3S,5S,7S-5-METHYLSULFONYL-2-ADAMANTYLPROPANAMIDE Not Available T2D,RA 1S,3R,4S,5S,7S-4-2-4-METHOXYPHENOXY-2-METHYLPROPANOYLAMINOADAMANTANE-1-CARBOXAMIDE Not Available T2D,RA 5R-2-2-fluorophenylamino-5-1-methylethyl-1,3-thiazol-45H-one Not Available T2D,RA
EPOR Darbepoetin alfa Aranesp CD Epoetin alfa Epogen CD 3,5 DIBROMOTYROSINE Not Available CD
GRB2 4-10s,14s,18s-18-2-Amino-2-Oxoethyl-14-1-Naphthylmethyl-8,17,20-Trioxo-7,16,19-Triazaspiro5.14Icos-11-En-10-YlBenzylphosphonic Acid Not Available CAD,CAD,CD,CD,CD,CD,CD,CD,CD,CD,CD,CD
NEU2 5-ACETAMIDO-5,6-DIHYDRO-4-HYDROXY-6-ISOBUTOXY-4H-PYRAN-2-CARBOXYLIC ACID Not Available CD
ATP1A1 Digoxin Cardoxin RA Acetyldigitoxin Acigoxin RA Deslanoside Cedilanid-d RA Ouabain Acocantherin RA Bretylium Bretylan RA Potassium Not Available RA Magnesium Not Available RA Digitoxin Crystodigin RA Almitrine Vectarion RA
ADRA1A Metaraminol Aramine RA,RA Nicergoline MNE RA,RA Ergonovine Ergotrate RA,RA Mephentermine Mephine RA,RA
The output shuld here also be those 7 files with different name then previous otherwise it will overwite
but here the input has those 7 words n+1 column where starts from 3.

Kindly check it.
# 10  
Old 08-07-2012
the file "sarattdnewdruggene5.txt" will be blank only.
Dont redirect the output to any file.
See your current directory there will be file with name from those 7 words.
as this was your requirement.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to dynamically fetch lines after a match?

Hi Friends, How to fetch current hour data from a log file, given below? I want all lines after the match "Wed Aug 13 16:" I have tried below command, but not working. If I put exact string, then it is working. cat /iscp/user/monitor/ORA_errors |awk '/`date +%h" "%d" "%h`/,printed==999 {... (7 Replies)
Discussion started by: suresh3566
7 Replies

2. Shell Programming and Scripting

Gawk gensub, match capital words and lowercase words

Hi I have strings like these : Vengeance mitt Men Vengeance gloves Women Quatro Windstopper Etip gloves Quatro Windstopper Etip gloves Girls Thermobite hooded jacket Thermobite Triclimate snow jacket Boys Thermobite Triclimate snow jacket and I would like to get the lower case words at... (2 Replies)
Discussion started by: louisJ
2 Replies

3. Shell Programming and Scripting

Match first column entries precisely and fetch whatever in front of it

Hi all I have 2 files: first file AABC TTYP JKBH CVBN NHJK KJHM Second file is AABC,XCYU,JUHD Alllele1 GACXT It is approved study TTYP,JKBH Allele2 PPRD It is clinical trial study JKBH Allele2 PPRD ... (5 Replies)
Discussion started by: Priyanka Chopra
5 Replies

4. Shell Programming and Scripting

Match columns and fetch whatever in front of it

Hi Solved these kind of issues using these codes But these are not wrking for my attached files can anybody check........ awk 'NR==FNR{X++;next}{if(X){print}}' file1 file2 awk 'NR==FNR{X=$0;next}{n=split($1,P," ");sub($1,"",$0);for(i=1;i<=n;i++){if(X]){print P,$0}}}' file1 FS="\t" file2 ... (6 Replies)
Discussion started by: Priyanka Chopra
6 Replies

5. Shell Programming and Scripting

Fetch entries in front of specific word till next word

Hi all I have following file which I have to edit for research purpose file:///tmp/moz-screenshot.png body, div, table, thead, tbody, tfoot, tr, th, td, p { font-family: &quot;Liberation Sans&quot;; font-size: x-small; } Drug: KRP-104 QD Drug: Placebo Drug: Metformin|Drug:... (15 Replies)
Discussion started by: Priyanka Chopra
15 Replies

6. Shell Programming and Scripting

Match words and fetch data in front of it in second column

Hi all, I have 2 files one file contain data like this in one column AST3 GSTY4 JST3 second file containign data like this in 2 columns AST3(PAXXX),GSTY4(PAXXY) it is used in diabetes KST4 it is used in blood... (6 Replies)
Discussion started by: manigrover
6 Replies

7. Shell Programming and Scripting

match sentence and word adn fetch similar words in alist

Hi all, I have ot match sentence list and word list anf fetch similar words in a separate file second file with 2 columns So I want the output shuld be 2 columns like this (3 Replies)
Discussion started by: manigrover
3 Replies

8. Shell Programming and Scripting

awk fetch numbers after the word

Hi, I would want to fetch all the numbers after a word the number of characters could very. how can I do that? below is the example of the data and the expected output sample data 03 xxxx occurs 1090 times. 04 aslkja occurs 10 times. I would want to fetch 10 & 1090 separately. (13 Replies)
Discussion started by: ahmedwaseem2000
13 Replies

9. Shell Programming and Scripting

Print all the words after a match word

Hi, I want to print all words till the last word after the match of "ERROR" word. For e.g. I'll get an sqlplus error with e.g. 1 $ ./calltest_fn.ksh var test_var:=test_fn1; calltest_fn.ksh file1 file2 file3 ERROR at line 4: ORA-06550: line 4, column 11: PLS-00201: identifier... (5 Replies)
Discussion started by: dips_ag
5 Replies

10. Shell Programming and Scripting

To fetch specific words from a file

Hi All, I have a file like this,(This is a sql output file) cat query_file 200000029 12345 10001 0.2 0 I want to fetch the values 200000029,10001,0.2 .I tried using the below code but i could get... (2 Replies)
Discussion started by: girish.raos
2 Replies
Login or Register to Ask a Question