BASH script: redirect file content to program
Posted on 2010-09-07
Hi, I have a C program which reads in two integers from the user, like so:
int A, B;
it then does some magic and outputs a line of numbers which I need to redirect to a file. Currently, I'm doing this like so:
echo $A $B | ./myprog.out >> output.dat
Now, however, I have a file called input.dat, which contains two columns of integers separated by a tab. I require a script that will go through each line in this file and do the above (pipe the numbers in, redirect the output to a file). I imagine this is easy, but I have no experience with Linux scripting...so, pretty please?