Sponsored Content
Top Forums Shell Programming and Scripting Comparing 2 file use c shell script Post 302456331 by proghack on Friday 24th of September 2010 12:00:39 AM
Old 09-24-2010
Hi, this is not homework . I assign to done this task in my job. I only success loop the 1st file. Then i want loop 2nd file i fail .
This is the code i done until now:
Code:
#!/bin/csh

set app_dir = "/ebsxe/ebs25/users/mmlim/assignment01"

set line_array = (`cat $app_dir/config_path`)
set line_array_2 =(`cat $app_dir/config_recipient`)

@ index1 = 1
@ index2 = 2
@ index3 = 3

@ lot1 = 1
@ lot2 = 2

while ( $index1 && $index2 && $index3 <= $#line_array )

        set dir = $line_array[$index1]
        set limit = $line_array[$index2]
        set class = $line_array[$index3]

        cd $dir
        set filecount = ( `ls -1 | wc -l` )

        if ( $filecount <= $limit ) then
                while ( $lot1 && $lot2 <= $#line_array_2 )
                set group = $line_array_2[$lot1]
                set email = $line_array_2[$lot2]

                if ( $class == $group )then
                echo " $class "
                endif

                @ lot1 += 2
                @ lot2 += 2
                end

        else
        echo " $class "
        endif

        @ index1 += 3
        @ index2 += 3
        @ index3 += 3

end

However when i include this code :
Code:
 while ( $lot1 && $lot2 <= $#line_array_2 )
                set group = $line_array_2[$lot1]
                set email = $line_array_2[$lot2]

                if ( $class == $group )then
                echo " $class "
                endif

My script load problem occur.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script comparing files in a file

There is a text file that contains the data in the following format: COLUMN1 COLUMN2 ABC 1 ABC 2 ABC 3 DEF 4 DEF 5 XYZ 7 We have to create a second text file... (4 Replies)
Discussion started by: raina_nalin
4 Replies

2. UNIX for Dummies Questions & Answers

shell script for comparing 2 files

Hi, how to read the 2 files and compare each other in shell script? i have 2 files test1 and test2, both files contains 20 character records.we have to compare file 1 records with file2, if exists then reject the record else we have to append it to test2 file. in file test1 around 100 single... (2 Replies)
Discussion started by: prashanth.spl
2 Replies

3. Shell Programming and Scripting

comparing two files using shell script

hi experts please help me to compare two files which are in different directory file1<file will be master file> (/home/rev/mas.txt} ex x1 x2 file2 <will be in different folder> (/home/rev/per/.....) ex x3 x4 the filesinside per folder i need to compare with master file and the files... (2 Replies)
Discussion started by: revenna
2 Replies

4. Shell Programming and Scripting

Comparing Alphanumeric Variables in Shell Script

Can someone please help me out here? I have strings similar to aafafaff45,29.34.942.45,edfdfafa that i want to compare to another similar string to check if they are the same. my script isn't working. ONE="aafafaff45,29.34.942.45,edfdfafa" TWO="ddfafagfa,87.57.942.45,afafafff" if ONE is... (5 Replies)
Discussion started by: SkySmart
5 Replies

5. Shell Programming and Scripting

comparing 2 files in shell script

I have 2 files config1h.txt ----------------- BFMU=ENABLE,ID=PM THR=OFF,REP=ALL,CON=IACM,TIM=OFF;GPON collection strategy 1.3.6.1.2.1.2.2:8 1.3.6.1.2.1.2.2:7 1.3.6.1.4.1.637.61.1.35.11.4:4 1.3.6.1.4.1.637.61.1.35.11.4:3 1.3.6.1.4.1.637.61.1.35.10.1:2 1.3.6.1.4.1.637.61.1.35.10.1:43... (7 Replies)
Discussion started by: LavanyaP
7 Replies

6. Shell Programming and Scripting

Comparing two array in shell script

In shell script i have two variables with value debit_sal="DOG,HIU,JIU,GYT,PPI,KIU,HUY........." debit_req='HIU, JIU, HUY, GTR, KOI, ............" i stored this two in two array arr=$(echo $debit_sal| tr "," "\n"); arr1=$(echo $debit_req| tr ", " "\n"); #(note second arry has comma with... (5 Replies)
Discussion started by: greenworld123
5 Replies

7. Shell Programming and Scripting

Comparing 2 files using shell script

Hi Experts, I have 2 files 1 file consists of 800 records and 2 file consists of 100 records with matching column as Membership_Num.So i need a script which will compare the 2 files and displays the output.As these are the files the script should take any delimter like (tab,comma) as input... (6 Replies)
Discussion started by: naveen.dasu
6 Replies

8. Shell Programming and Scripting

shell script for comparing two files

Hi, I have 2 files as below FILE1.dat co1|co2|co3 abnd|45.56|AZ dkny|30.2|PA sam|.23|VA FILE.CTL FILENAME|FILE1.dat NO OF RECORDS|3 CHECKSUM|75.99 Could you please help me to write a shell script to compare 1. TOTAL RECORDS from FILE1.dat with NO of RECORDS in FILE.CTL 2.... (8 Replies)
Discussion started by: dreamsportsteam
8 Replies

9. Shell Programming and Scripting

Comparing dates in shell script

Hi All, I have a date variable say dt="2014-01-06 07:18:38" Now i need to use this variable to search a log and get the entries which occured after that time. (1 Reply)
Discussion started by: Girish19
1 Replies

10. UNIX for Dummies Questions & Answers

Shell script needed for comparing two files

Hi, I need shell script to compare the two files based on certain fields and output should contains the required fields based on result.pls find sample input files and required output file 1 COUNT, BNG_IP,PORT,OVLAN 22 , 10.238.60.129,1/1,2009 144 , 10.238.60.129,1/1,2251 ... (5 Replies)
Discussion started by: surender reddy
5 Replies
GENLIB_PLACE_ON.3(October 1, 1997)										GENLIB_PLACE_ON.3(October 1, 1997)

NAME
GENLIB_PLACE_ON - place a physical instance in the current figure matching connectors SYNOPSYS
#include <genlib.h> void GENLIB_PLACE_ON(figname,ins1,con1,index1,symetry,ins2,con2,index2) char *figname, *ins1, *con1, *ins2, *con2; char symetry; long index1, index2; ORIGIN
This software belongs to the ALLIANCE CAD SYSTEM developed by the ASIM team at LIP6 laboratory of Universite Pierre et Marie CURIE, in Paris, France. Web : http://asim.lip6.fr/recherche/alliance/ E-mail : alliance-users@asim.lip6.fr PARAMETERS
figname Name of the layout figure to be instanciated ins1 Name to be given to the instance in the model con1 Name of the connector of the instance to be used for placement index1 Index of the connector, or reference, con1 of the model to be used for placement symetry Geometrical operation to be performed on the instance before beeing placed ins2 Name of the instance to be used for relative placement con2 Name of the connector of the instance ins2 on which the placement will take place index2 Index of the connector con2 of the instance to be used for relative placement DESCRIPTION
PLACE_ON add an instance in the current layout cell. The bottom left corner of the instance of the model modelname is placed, after beeing symetrized and/or rotated, at (x, y) coordinates. The placed instance becomes the new "reference instance", used in the relative placement functions. The insname is the name given to the instance and must be unique at a given hierarchy level. The symetry argument can take eight legal values : NOSYM no geometrical operation is performed SYM_Y Y becomes -Y, that means toward X axe symetry SYM_X X becomes -X, that means toward Y axe symetry SYMXY X becomes -X, Y becomes -Y ROT_P a positive 90 degrees rotation take place ROT_M a negative 90 degrees rotation take place SY_RP Y becomes -Y, and then a positive 90 degrees rotation take place SY_RM Y becomes -Y, and then a negative 90 degrees rotation take place The model of the figure to be placed must be available, on disk or in memory. The path to the library is specified in the MBK_CATA_LIB (1) and MBK_WORK_LIB (1) environment variables, and its format is given by the MBK_IN_PH (1) environment variable. ERRORS
"GENLIB_PLACE_ON impossible : missing GENLIB_DEF_PHFIG" No figure has been yet specified by a call to DEF_PHFIG. So it isn't possible to place an instance inside it. you must call DEF_PHFIG before any other layout action. "illegal addphins : transformation is x in insname" The symetry parameter is not one of the define given, but has the integer value x. EXAMPLE
#include <genlib.h> main() { /* Create a figure to work on */ GENLIB_DEF_PHFIG("cell"); /* Place two instances */ GENLIB_PLACE_ON("gapg0_b","ins1", NOSYM, 0L, 0L); GENLIB_PLACE_ON("gapg8_b","ins2", SYM_X, 80L, 100L); /* Save all that on disk */ GENLIB_SAVE_PHFIG(); } SEE ALSO
genlib(1), GENLIB_DEF_PHFIG(3), GENLIB_SAVE_PHFIG(3), GENLIB_PLACE_TOP(3), GENLIB_PLACE_BOTTOM(3), GENLIB_PLACE_LEFT(3), GEN- LIB_PLACE_RIGHT(3), MBK_CATA_LIB(1), MBK_WORK_LIB(1), MBK_IN_PH(1). BUG REPORT
This tool is under development at the ASIM department of the LIP6 laboratory. We need your feedback to improve documentation and tools. PROCEDURAL GENERATION LANGUAGE
ASIM/LIP6 GENLIB_PLACE_ON.3(October 1, 1997)
All times are GMT -4. The time now is 08:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy