Query on find command
by nextStep from LinuxQuestions.org on (#4YCM5)
Hi
I am trying to get the file size,date time and filename from a remote server using shell script and automate the result every weekend.If i split the command individually the command works,however if given in shell script not getting the result,getting blank result.
Code:ssh user@$server "find /path1/path2/ -type f -name '*.json' -exec ls -lh {} \; | awk '{print $9 "\t" $8 " " $7 $6 "\t" $5}' | sed -r 's/^.+\///'"Expected result is as below
loc.json 15:04 21Jan 731M
prop.json 15:06 21Jan 4.7G
The file info
-rw-r--r-- 1 tomcat tomcat 731M Jan 21 15:04 loc.json
-rw-r--r-- 1 tomcat tomcat 4.7G Jan 21 15:06 prop.json
Any help is appreciated


I am trying to get the file size,date time and filename from a remote server using shell script and automate the result every weekend.If i split the command individually the command works,however if given in shell script not getting the result,getting blank result.
Code:ssh user@$server "find /path1/path2/ -type f -name '*.json' -exec ls -lh {} \; | awk '{print $9 "\t" $8 " " $7 $6 "\t" $5}' | sed -r 's/^.+\///'"Expected result is as below
loc.json 15:04 21Jan 731M
prop.json 15:06 21Jan 4.7G
The file info
-rw-r--r-- 1 tomcat tomcat 731M Jan 21 15:04 loc.json
-rw-r--r-- 1 tomcat tomcat 4.7G Jan 21 15:06 prop.json
Any help is appreciated