Changes in code to provide proper result with one additional fiield


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Changes in code to provide proper result with one additional fiield
# 1  
Old 11-14-2012
Changes in code to provide proper result with one additional fiield

Hi all


I am using following code to get results for brand name drug target name and generic name from my attached fiile


Code:
awk 'k>0 {if (a[k] && k==2) {print a[1]":"a[2]":"a[3]; a[1]=a[2]=a[3]="";} a[k]=a[k]?a[k]","$0:$0; k=0;} /^# Drug_Target_.*_Gene_Name/ {k=3;} /^# Generic/ {k=1;} /^# Brand_Name/ {k=2;} END {if (a[1]) print a[1]":"a[2]":"a[3];}' drugbank.txt >drugbank3.txt

But when I change the code to additional field Drug Type. It is not giving me proper results can anybody guide to make changes in this code to get drug type as well.

---------- Post updated at 10:30 PM ---------- Previous update was at 10:04 PM ----------

Hi

Its working now using the same code completely dont know why? can any body try on his or her system?Smilie
# 2  
Old 11-15-2012
There is no attached file. You haven't given us a sample of your input. You haven't given us a sample of the wrong output you were getting. You haven't given us a sample of the output that you wanted and are now getting. You haven't told us what kind of system you're using.

Under these conditions, there isn't much we can do to help. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl : code on ping showing difference result

Hi all, I am using the below code to ping a code and print whehter the connection is successful or not. use Net::Ping; $p = Net::Ping->new(); my $host = "x.x.x.x"; # print "$host is alive.\n" if $p->ping($host); if ($p->ping($host,3)) { print... (0 Replies)
Discussion started by: scriptscript
0 Replies

2. Fedora

sftp Unspecified GSS failure Minor code may provide more information No credentials cache found

Hi I have managed on numerous machine to set up sftp not too require a password - i finally have one that does not work and Im at a loss - looked around checked permissions etc The 2 machines Ill call then source and target I need to sftp from source to target (previously the target has... (3 Replies)
Discussion started by: wwwdaryl
3 Replies

3. Shell Programming and Scripting

Writing a UNIX script from LOG to provide return code.

Folks - Firstly, I do apologize that my first post here is a question. I am quite familiar with UNIX since our application is running on it. We are trying to automate a few things on our end and I am challenged with a task in hand that requires UNIX scripting. I am totally a newbie in UNIX... (4 Replies)
Discussion started by: sk72
4 Replies

4. Shell Programming and Scripting

Mail::Sender - How to Check Result Code?

I have a code block which sends a mail using Mail::Sender. Everything works great now. I just want to know how to check whether the status of sending mail is success or failure. Based on which I will log the result in my log file. How can I do this? Any idea please? (2 Replies)
Discussion started by: dahlia84
2 Replies

5. Shell Programming and Scripting

Encrypt source code or Provide execute only permission

To perform a black box testing and get users' feedback, we are planning to deploy a script in a common location and ask users to execute the script. However we do not want them to have a look at the script until the testing is done. I know this is against the open source concept, but it will be for... (7 Replies)
Discussion started by: krishmaths
7 Replies

6. UNIX for Dummies Questions & Answers

Newbi - Understanding the Code and proper download

Hi, I am new to Unix and there is code that is trying to get data from a location and save it. However it's output is messing up some date fields in the source file (ie... in source is may say 10/10/2008, the code will output 10/10/20088). This is the piece of code. Can someone help to... (2 Replies)
Discussion started by: mpinto
2 Replies

7. Shell Programming and Scripting

Pick up the return code for every iteration and display the result only once in loop.

Hi All, I amlearning UNIX scripting. I have a small query. I would be thankful if any one helps me out. I have a below piece of code which delets the files. If file dosent have the permissions to delete a particular file I have used 2>>operator to track the error code. But my objective is... (1 Reply)
Discussion started by: manas6
1 Replies

8. AIX

The shell script is not returning proper result

Can anybody pls look into this script and tell me where I went wrong. After running this script, it is showing like "Trying to overlay current working directory ABORT!!!" :-( ARGCNT=$# if then echo "Two parameters are needed for this shell " echo "Please try again with... (1 Reply)
Discussion started by: clnsharma123
1 Replies

9. UNIX for Dummies Questions & Answers

server based Including additional code > Lycos way

For a project we need to make sure that all php / html files in a certain directory on the webserver are showing advertisments of us. For example, when you get a website from Lycos, you'll have an advertisement in the right corner. How to? As far as I can see, Lycos includes a javascript... (1 Reply)
Discussion started by: valentijnb
1 Replies
Login or Register to Ask a Question