Hi CHirel
Thankyou very much It was very helpful
On the same lines I posted one more question
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
Code:
Name Drug DAP ID disease approved or not
In the attached file data is arranged with tab separated columns in this way:
Quote:
TTDS00001 Name
Drug(s) DAPID Disease name Approved /(blank)
and other data is also present which I dont want to fetch
I want the output should be like this
Quote:
Name Drug DAP ID disease Approved or not
Muscarinic Bethanechol DAP000263 Urinary retention Approved
acetylcholine
receptor
Can u please check once. Highly thankful toyou.
---------- Post updated at 12:00 PM ---------- Previous update was at 01:46 AM ----------
Hi
I found one issue from previous answer because I have to separate into three different columns and its not showing in three columns as there is space beteeen gene names as well as within generic and brand ame then I m trying to make 2 different files with generic and brand names
can we separate brand name and generic name?
means
For only generic name using
Quote:
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;} END {if (a[1]) print a[1]" "a[2]" "a[3];}' drug_bank.dat
For only brand name
Quote:
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;} /^# Brand_Name/ {k=2;} END {if (a[1]) print a[1]" "a[2]" "a[3];}' drug_bank.dat