Question

I have a bash shell script which moves the file from machineB and machineC into machineA.

File name is like below and it will be inside this directory - /data/pe_t1_snapshot/20140320 in machineB and machineC

weekly_1980_991_200003_5.data

Above file name is going to be same always only the file number which is 991 is going to be change as I have multiple files.

Is there any way to find out what are the files which came from machineB and which files came from machineC into machineA using some sort of subset of files (diff in bash). I would like to run the command from machineA to find out about the files.

Below is one way I can think of. I will be running the below command on machineA where my files are but somehow it doesn't return me those files which came from machineC

diff -B <(ssh user@machineC "ls -R ~/20140320/") <(ls -R .)

Is there anything wrong I am doing?

Was it helpful?

Solution

You could try something like :

cat <(ssh user@machineC "ls 20140320|sort -u") <(ls .|sort -u)|sort|uniq -d # list of file provided by machineC
cat <(ssh user@machineB "ls 20140320|sort -u") <(ls .|sort -u)|sort|uniq -d # list of file provided by machineB
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top