[prog] shell script

Diana Ionescu dianabesliu at yahoo.com
Fri Jun 22 01:37:16 UTC 2007

Hi there,

Here is one of my questions that I don't have an answer for ... yet... and one of the "dumb questions"...
I do have a solution - a C code written by my hubby, but I want my own :-))

So... what I'm trying to do is: operate operation "bin_op" on two files which are listed in my LIST_i and LIST_j as rows.
I'm getting the "name" of the file and the extensions (ex file name: 133012.fts - hhmmss.fts) and I want bin_op on the same row in both files, without 59 unnecessary files that are coming out from my script below.
But if the difference between the times is -1 or 59 I don't want to do this difference.

So I need a condition for "FOR"  not to go intro a double cycle or a condition on if to constrain all the unnecessary operations.
For the moment I would be happy with the script below, IF dif=a-b would give me a number. As it is, a and b are just characters and a-b just prints 30-31 and dos not *do* 30-31=-1

Many thanks in advance.



for i in `cat LIST_i`

    for j in `cat LIST_j`

    ATR_i=`echo $i | awk '{len=length($1)} {print substr($1, len - 7, 2)}'`
    EXT_i=`echo $i | awk '{len=length($1)} {print substr($1, len-3)}'`
    echo $ATR_i
    echo $EXT_i

    ATR_j=`echo $j | awk '{len=length($1)} {print substr($1, len - 7, 2)}'`

    echo $ATR_i-$ATR_j


    echo $dif

    if [ dif="-1" ]  ;
        then  bin_op $i minus $j -o 'kk_'$i'_'$j'_'$EXT_i
        else echo dif


Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 

More information about the Programming mailing list