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]

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.