and 2nd file let say b.txt contain only one column speciality:
Speciality
Abdominal
ADDICTION MEDICINE
ALLERGY
Adolescent Medicine
Family Practice
General Practice
so i want to map b.txt file column, speciality with the a.txt file and after mapping of the strings i want to get the UMP_CODE of the respected feilds also which mapped in both column. i want to assign variables name( a = &Family Practice) so that i change the fields as it is changing in every file.
my output is like this:
SPECIALITY UMP_CODE
Aerospace Medicine 1.041666667
Addictive Diseases 03C
Cardiology 03C
Family Practice 07FP
Allergy & Immunology 01A
---------- Post updated at 11:12 AM ---------- Previous update was at 10:46 AM ----------
hey its ok i made it work by myself.....
my code is like this
awk ' BEGIN { FS="|";
while ( getline < "all_spec.txt" > 0)
a[$1]=$2
}
{
if($1 in a)
printf("%s %s\n", $1, a[$1])
} ' sample.txt
but as i said you earlier i am new to UNIX so having a lot of questions in my mind,
and lot of doubts. one of them is like as in normal programming we declare variables
and later use those variables in our function and loops,in the same way i want to declare variable and can use it inside the script.
Like i want to assign my b.txt fields as variable as a= General Practice, b= Family practice
and later can use in the script. Is it possible if it is then help me on
this program how to do this by declaring variables in the above codes.
so rply as soon as possible..................