Comparing a batch of files to a test file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Comparing a batch of files to a test file
# 1  
Old 09-14-2010
Comparing a batch of files to a test file

Hi

I am writing a script to run a loop through a directory and run a diff on each file against my test file.

I then want to time how long each file to process (not sure how time works), as well as how long all the files took as a whole to process.

Here is my code

Code:
#!/bin/bash
#Old file is empty. New file is full. 
#This script adds the cells to the database.
module=`basename $0`
newfile="$newfile"
dsxfile=""
DSXLOG_MODULE=$module; export DSXLOG_MODULE
dsxpids="/var/run/"
diffdir="var/local/dsx/diff"
compfile="$newfile.final"
 dsxlog $reverb --info --module="$module" "started pid = $$" 
 touch ${dsxpids}$module.pid
 printf "%i\n" $$ > ${dsxpids}$module.pid
 dsxlog $reverb --info --module="$module" "processing batch files"
 for newfile in $diffdir/*.dsx;
 do
  dsxlog $reverb --info --module="$module" "now processing ${newfile##*/}"
 /usr/local/bin/dsxdiff \
 --compatibility \
 -otestEmpty.dsx  \
 --newfile=$newfile  \
 
 
diff testEmptyFull.dsx $newfile.final > /var/local/dsx/diff/temp.dsx
if [ $? -eq 0 ]
then
 echo $testname passed
else
 echo $testname FAILED
fi
 
 done
 rm -f ${dsxpids}$module.pid
    dsxlog $reverb --warning --module="$module" "pid = $$ : Removing pid file"
 dsxlog $reverb --info --module="$module" "ended, pid = $$"


When I run it, I get the following error:

Code:
$ ./plannedFiles
diff: var/local/dsx/diff/*.dsx: No such file or directory
failed to compare files
diff: var/local/dsx/diff/*.dsx.final: No such file or directory
FAILED
 
 
I appreciate some help.
 
Thaks guys

# 2  
Old 09-14-2010
I didn't go into your script very deep, but isn't this line missing slash at the beginning?
Code:
diffdir="var/local/dsx/diff"

Code:
diffdir="/var/local/dsx/diff"

This User Gave Thanks to bartus11 For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Test if Remote server is up and running before SFTP'ing files (in batch mode)

Hello, In our Data Warehouse environment, before our batch SFTP jobs kick off to pull the files from remote servers, I would like to setup a pre-sftp job that would test if all the remote servers from where the files are being pulled, are up and running. If any one of the remote serer is... (2 Replies)
Discussion started by: Dippu
2 Replies

2. Shell Programming and Scripting

Comparing two files and creating a new file

Hi, I want to compare two files based on the data in their first column. Both the files are not equal in their number of columns and number of entries or rows. The entries (only the first column) of the file1 should be compared with the entries (only the first column) of the file2. If the... (3 Replies)
Discussion started by: begin_shell
3 Replies

3. UNIX for Dummies Questions & Answers

Comparing two test files and printing out the values that do not match

Hi, I have two text files with matching first columns. Some of the values in the second column do not match. I want to write a script to print out the rows (only the first column) where the values in the second column do not match. Example: Input 1 A 1 B 2 C 3 D 4 Input 2 A 2 B 2... (6 Replies)
Discussion started by: evelibertine
6 Replies

4. Shell Programming and Scripting

Executing a batch of files within a shell script with option to refire the individual files in batch

Hello everyone. I am new to shell scripting and i am required to create a shell script, the purpose of which i will explain below. I am on a solaris server btw. Before delving into the requirements, i will give youse an overview of what is currently in place and its purpose. ... (2 Replies)
Discussion started by: goddevil
2 Replies

5. OS X (Apple)

Batch file to move video files and retain sub-directories

I have just purchased my first ever Apple computer - and am therefore new to UNIX also. I would like to create a simple "batch file" (apologies if this is the wrong terminology) to do the following: When I plug my camera into the MAC it automatically downloads photos and videos into a new... (1 Reply)
Discussion started by: mm0mss
1 Replies

6. Windows & DOS: Issues & Discussions

Batch file to Get New Files Only through FTP

Hi there I want to create a batch file which Get (mget) the newly added Files only from specific directory on UNIX server to specific folder on windows server using FTP, and this batch file will be scheduled on the windows server to run daily to load the new files (load the newly added files... (1 Reply)
Discussion started by: alsharq
1 Replies

7. Windows & DOS: Issues & Discussions

Batch file to Get New Files Only through FTP

Hi there I want to create a batch file which Get (mget) the newly added Files only, from specific directory on UNIX server to local folder on windows server through FTP, and this batch file will be scheduled to run daily to load the new files. help me plz :confused: (1 Reply)
Discussion started by: alsharq
1 Replies

8. Shell Programming and Scripting

bash - batch script for extracting one file from multiple tar files

so i have hundreds of files named history.20071112.tar (history.YYYYMMDD.tar) and im looking to extract one file out of each archive called status_YYYYMMDDHH:MM.lis here is what i have so far: for FILE in `cat dirlist` do tar xvf $FILE ./status_* done dirlist is a text... (4 Replies)
Discussion started by: kuliksco
4 Replies

9. Shell Programming and Scripting

comparing files to contents of a file

Hi I have a problem trying to run a while statement. I have files under one directory that i need to compare to a value in filex and update that file with the result files in the directory are DFC1. DFC5. DFC345. DFC344. DFC9. The program i am trying to run will take the number... (3 Replies)
Discussion started by: SummitElse
3 Replies

10. Windows & DOS: Issues & Discussions

Schedule a Batch file to delete files at particular intervals

Hi, I need to write a batch file/shell script that runs at specified intervals daily and deletes specified set of files. Can anyone pls help me with the code. Thanks, Indom. (6 Replies)
Discussion started by: Indom
6 Replies
Login or Register to Ask a Question