| | |
diff files script
![]() |
•
•
Join Date: Sep 2007
Posts: 25
Reputation:
Solved Threads: 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}
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 Looks like you need to enclose your $line|sed in both cases! Try this:
Hope it helps!
-G
Shell Scripting Syntax (Toggle Plain Text)
for line in $(ls *.new); do file1="${line}" file2="$(echo ${line} | sed 's/\(.*\)..../\1/')" diff ${file1} ${file2} done
Hope it helps!
-G
![]() |
Similar Threads
- dynamic html (PHP)
- Urgent hep is required (Shell Scripting)
- cronjob problem in the script (Shell Scripting)
- Script to delete or backup logs at a specific time and under specific user (Shell Scripting)
- Help needed in this script (Shell Scripting)
- Comparing two files and output values that match (Shell Scripting)
- About "diff -y" (Shell Scripting)
- ftp and compare script (Shell Scripting)
- sendmail problem using cron (Shell Scripting)
- Importing SQL Script File - Urgent !! (Database Design)
Other Threads in the Shell Scripting Forum
- Previous Thread: Need help in shell scripting
- Next Thread: wildcarding paths
| Thread Tools | Search this Thread |





