0
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}


[B]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[/B]
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by JeoSaurus
0

Looks like you need to enclose your $line|sed in both cases! Try this:

for line in $(ls *.new); do
  file1="${line}"
  file2="$(echo ${line} | sed 's/\(.*\)..../\1/')"
  diff ${file1} ${file2}
done

Hope it helps!
-G

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.