Hi,
The blow code does not yeild any output.
find . -name "*.jar" -o -name "*.ksh" -o -name "*.properties" -name "*.war" -o -name "*.ear" -o -name "*.sh" -o -name "*.cfg" -exec ls -l {} \;
I wish to print the filename filesize filedate in HP-UX.
Can anyone help ?
NareshN
September 6, 2012, 4:12am
2
try this
ls -lrt .jar* | awk '{print $9,$5,$6,$7,$8}
Here $9 is filesize, $5 is filesize and $6,7,8 is filedate
nareshn:
try this
ls -lrt .jar* | awk '{print $9,$5,$6,$7,$8}
Here $9 is filesize, $5 is filesize and $6,7,8 is filedate
I need
find
command as I am checking under sub directories as well.
Ygor
September 6, 2012, 4:21am
4
Instead of -exec ls -l {} \;
try using -ls
I tried these but both of them failed.
==> find . -name "*.jar" -o -name "*.ksh" -o -name "*.properties" -name "*.war" -o -name "*.ear" -o -name "*.sh" -o -name "*.cfg" -ls
find: bad option -ls
shp051a1:/appl/bea/deployments>
==> find . -name "*.jar" -o -name "*.ksh" -o -name "*.properties" -name "*.war" -o -name "*.ear" -o -name "*.sh" -o -name "*.cfg" ls
find: missing conjunction
Ygor
September 6, 2012, 4:43am
7
Perhaps try using brackets....
find . \( -name "*.jar" -o -name "*.ksh" -o -name "*.properties" -name "*.war" -o -name "*.ear" -o -name "*.sh" -o -name "*.cfg" \) -print | while read f; do ls -l "$f"; done
ygor:
Perhaps try using brackets....
find . \( -name "*.jar" -o -name "*.ksh" -o -name "*.properties" -name "*.war" -o -name "*.ear" -o -name "*.sh" -o -name "*.cfg" \) -print | while read f; do ls -l "$f"; done
This works !!! but below is the output ...
-rw-r--r-- 1 bea users 49632210 May 19 15:51 ./hello.ear
Now, I need filename, File size and file date these three in this format.
Can you help ?
Ygor
September 6, 2012, 5:33am
9
Just pipe the ls through the awk command as posted by NareshN
1 Like
alister
September 6, 2012, 8:23am
10
Note that all of the find commands are missing a -o
operator between -name "*.properties"
and -name "*.war"
. This causes the expression to be false when a file matches either pattern, excluding wanted files from the output.
Regards,
Alister