diff files script

Reply

Join Date: Sep 2007
Posts: 25
Reputation: axn is an unknown quantity at this point 
Solved Threads: 0
axn axn is offline Offline
Light Poster

diff files script

 
0
  #1
Nov 13th, 2008
trying to diff new files in a dir

cd ${PWD}
for line in $(ls *.new)
     do
            # lists all new files and then 2nd variable strips the .new extension of the files
            echo ${line} ${line} | sed 's/\(.*\)..../\1/'
            diff ${line} ${line} | sed 's/\(.*\)..../\1/' 
	# this doesnt seem to work
             
# tried this way and still not working
        file1 = ${line}
        file2 = ${line} | sed 's/\(.*\)..../\1/'
        diff ${file1} ${file2}


collabrpt_cslbos.new collabrpt_cslbos
diffusql[7]: file1:  not found
diffusql[8]: file2:  not found
diff: two filename arguments required
dam.usql.new dam.usql
diffusql[7]: file1:  not found
diffusql[8]: file2:  not found
diff: two filename arguments required
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 61
Reputation: Gromit is an unknown quantity at this point 
Solved Threads: 7
Gromit's Avatar
Gromit Gromit is offline Offline
Junior Poster in Training

Re: diff files script

 
0
  #2
Nov 13th, 2008
Looks like you need to enclose your $line|sed in both cases! Try this:

Shell Scripting Syntax (Toggle Plain Text)
  1. for line in $(ls *.new); do
  2. file1="${line}"
  3. file2="$(echo ${line} | sed 's/\(.*\)..../\1/')"
  4. diff ${file1} ${file2}
  5. done

Hope it helps!
-G
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Shell Scripting Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC