Using terms like "urgent" or "quickly" and/or bumping up posts is not THAT well received in these forums as people are volunteers spending their free time trying to help people solve their problems.
You can help speed up things from your side by giving an excellent specification or description of the problem, respectively, including details of your system and using code tags as required by forum rules.
Assuming you are using a modern bourne type shell, you can use "command substitution" to supply a command's output to e.g. diff . To give a more taylored answer, more info is needed, like
how many files are in each of those directories?
check every files against each of the other files?
Do you want files that have same name - time-stamp is the same value on both files?
Otherwise you need to be more exact in your requirement - by that I mean: please explain what you are doing -NOT how you think it should be done
If you do differences on every file from each of 30 directories, you will have a mountain of output to deal with. After a long wait. That would be true even if you had only 3 files in each directory.
how many files are in each of those directories?
we will have many other files , we need to diff with the first file that was created in each directory of that day and with latest last file at the time of doing diff
check every files against each of the other files?
No , need to diff from first file that was created in each directory of that day and with latest last file at the time of doing diff
all results to the same newfile?
yes all results will be same file
we can put come thing echo "========= dir1 ============" in between
any dirs in that path to be excluded?
no all dirs need to be checked
@ Jim
we need to diff with the first file that was created in each directory of that day and with latest last file at the time of doing diff and output should go single file
So - where lies your problem? Using ls (together with other commands) to gain the two desired filenames, or presenting them to diff ?
And, what you specify in post#4 will need a script, more or less, which goes beyond what you said in post#1 and the title. Why don't you start over and give us a detailed spec accompanied with meaningful input and desired output samples? We still don't know your OS nor shell version...
i need to cd to 30 to 40 dirs and need to ls for ls *.xml and we need to diff the first file that was created in each directory of that day and with latest last file at the time of doing diff[/LEFT]
im looking how we can present the desired files to diff , i hope specification clear
im using bash here , what ever the best possible way we can go with , here is sample snippet
For entry in /mydir/*
Do
If [-d "$entry" ,]; then
Echo "$entry"
CD $entry
ls *xml
# we need to diff the first file that was created in each directory of that day and with latest last file at the time of doing diff
Diff file1.xml file2.xml >> diff.txt
Fi
Done
That will give him the oldest *.xml file in the current directory as a 1st operand; not the oldest file created today. And, it isn't clear whether the submitter wants the oldest modification time timestamp today on a file or the oldest timestamp today encoded in the files' names. Note that the specified files to be examined (according to post #1 in this thread) have names like:
abc-<time-stamp>.xml
xyz-<time-stamp>.xml
with varying numbers of leading <blank> characters, three lowercase alphabetic characters, a hyphen, a less-than symbol character, an unspecified time-stamp format string, and a greater-than symbol character, followed by the string .xml .
Note also that the homework question has been asked, and the submitter has not responded to that question! Until that question is answered, please refrain from providing possible solutions in this thread.