The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 03-19-2009
vincyoxy vincyoxy is offline
Registered User
  
 

Join Date: Mar 2009
Location: Singapore
Posts: 12
Exclamation Help with awk in array in while loop

Hi everyone
I have 2 files - IN & OUT. Example:

IN
A:13:30
B:45:40
.
.
. UNLIMITED

OUT
Z:12:24
Y:20:15
.
.
. UNLIMITED


I want first row of numbers of IN - OUT. Example 13-12 45-20
My code is

#!/bin/csh -f
set y=1
while ( $y<UNLIMITED )
set in = `awk -F':' '{print $2}' IN |awk '{array[NR]=$0} END {print array[y];}'`
set out = `awk -F':' '{print $2}' OUT |awk '{array[NR]=$0} END {print array[y];}'`
set number = `expr $in - $out`
echo "$number"
@ y = $y + 1
end

expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
all is expr: syntax error
I tried to solve more than one day already. And also duno wat should i write instead of UNLIMITED.
Anyone can help me?