The UNIX and Linux Forums  


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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
FTP and run a loop for array problem tuffgong2008 Shell Programming and Scripting 3 12-19-2008 04:56 PM
Reading from while loop into an array ssuresh1999 UNIX for Dummies Questions & Answers 2 08-12-2008 12:53 PM
Array in loop is acting up RisingSun Shell Programming and Scripting 5 08-07-2008 03:21 PM
How to use array values after the loop. Devesh5683 Shell Programming and Scripting 1 05-13-2008 08:38 PM
Array Declaration and For Loop 33junaid Shell Programming and Scripting 4 09-15-2007 05:16 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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?
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:02 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0