Hello,
I have one small question where you awk-users can propably give an answer
I have a text file (file.txt) containing two columns and multiple rows
#cat file.txt
Alfa 0001
Beta 0002
Gamma 0003
.
..
...
In my program I do the following for each line using a program i.e which converts Fahrenheits to Celcius
for i in `awk '{print $2}' file.txt`
do
program_name $i >> output.txt
#here for each line we feed the second column as a parameter
done
What I would like to do is to get as a result
cat output.txt
In temperature Alfa converted from Fahrenheit to Celcius is X degrees
In temperature Beta converted from Fahrenheit to Celcius is X degrees
In temperature Gamma converted from Fahrenheit to Celcius is X degrees
So
The principal using variables doesn't exactly work as I hope there is a slight glitch where I need your assistance
for i in `awk '{a=($1),b=($2),print a,b}' file.txt`
do
echo "In temperature" $a "converted from Fahrenheit to Celcius is" program_name $b "degrees" >> output.txt
done
Kind Regards,
Kimmers,
hd_starsky@yahoo.com
I have one small question where you awk-users can propably give an answer
I have a text file (file.txt) containing two columns and multiple rows
#cat file.txt
Alfa 0001
Beta 0002
Gamma 0003
.
..
...
In my program I do the following for each line using a program i.e which converts Fahrenheits to Celcius
for i in `awk '{print $2}' file.txt`
do
program_name $i >> output.txt
#here for each line we feed the second column as a parameter
done
What I would like to do is to get as a result
cat output.txt
In temperature Alfa converted from Fahrenheit to Celcius is X degrees
In temperature Beta converted from Fahrenheit to Celcius is X degrees
In temperature Gamma converted from Fahrenheit to Celcius is X degrees
So
The principal using variables doesn't exactly work as I hope there is a slight glitch where I need your assistance
for i in `awk '{a=($1),b=($2),print a,b}' file.txt`
do
echo "In temperature" $a "converted from Fahrenheit to Celcius is" program_name $b "degrees" >> output.txt
done
Kind Regards,
Kimmers,
hd_starsky@yahoo.com