I intend to modify the output of ls -la to display the output of file
command.
The below command works well for the purpose
find /opt -type f | xargs ls -let | awk 'BEGIN { OFS="\t" } { sprintf("file \"%s\"", $10) | getline type; print type,$1,$3,$4 }' | tr ":" "\t"
Now, I want to modify this to display the ouput of ldd
command(comma separated), if the file type output matches pattern "ELF.*execuatble". I tried various combinations to match a keyword using if
inside that awk, and if the match is successful, to run ldd
, but to no avail.
Is this possible?
The operating system is Solaris and I am working in ksh.
sprintf("file \"%s\"", $10) | getline type
? shouldn't you useprintf "file \%s\" %s %s %s\n",$10,$1,$3,$4 ;
? have you consider changing your find clause tofind bin -type f -ls -exec file {} \;
? – Archemar May 11 '15 at 7:36/usr/xpg4/bin/
binaries in PATH - am able to run my command using that. – Prasoon May 11 '15 at 7:54