Reading lines within a Unix file.

I have a file that has a list of numbers in it. Each line has a different number. I am trying to create some sort of loop within a script that will pick the numbers up on lines 1 and 2 and then put those figures into the script. It then goes through the process then loops back and reads lines 2 and 3. This is to keep looping till it reaches the end of the file. The problem i am having is that i do not know what command to use to pick up the relevant lines.

Can anyone help please.

Try....

awk 'NR>1{print prev " " $1}{prev=$1}' file1 |\
while read VAR1 VAR2
do
     echo script commands can use $VAR1 $VAR2
done

I do not think this will work as it will on pick out the first couple of lines. I need something that will pick up lines 1&2 use them in the script, then loop back and use lines 2&3, then loop back and use line 3&4 etc........

Can anyone else help

Think again. Maybe you should try it before you dismiss it.

Tested...

$ cat file1
nane
jees
tree
kiare
queig

$ awk 'NR>1{print prev " " $1}{prev=$1}' file1 |\
> while read VAR1 VAR2
> do
> echo script commands can use $VAR1 $VAR2
> done
script commands can use nane jees
script commands can use jees tree
script commands can use tree kiare
script commands can use kiare queig

Thanks Ygor, i am humble to your superior knowledge. It works what you suggested but could you please give my a brief summary of how it works it out.