![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Advanced I/O | thangappan | UNIX for Advanced & Expert Users | 1 | 04-22-2008 08:10 PM |
| Advanced LS? | bostonrobot | UNIX for Dummies Questions & Answers | 2 | 06-10-2007 12:44 PM |
| Advanced Getopts | stefan_hery | Shell Programming and Scripting | 2 | 05-08-2005 06:16 PM |
| Advanced For loop | petrk1 | Shell Programming and Scripting | 9 | 03-02-2005 02:34 AM |
| Recursive directory listing without listing files | psingh | UNIX for Dummies Questions & Answers | 4 | 05-10-2002 07:52 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
advanced dir listing
Hi
i know this Q might seem retarded... yet, i can't find a solution. i need a bash script that recursively prints like this: mydir/ myfile1 114 06 Aug 2006 myfile2 234 14 Jun 2006 mydir/mysubdir1/ myfile3 32 18 Feb 2006 mydir/mysubdir1/mysubsubdir1/ myfile4 5324 06 Aug 2006 it looks SO easy... thx in advance!! |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
start with find, add an "ls" command with options that you want like this
Code:
find /mydir -print -exec ls [add ls options here] {} \;
(example of swapping say col 4 and col 6 and not printing col 5) Code:
find /mydir -print -exec ls -l {} \; | awk '{ print $1, $2, $3, $6, $4}'
|
|
#3
|
|||
|
|||
|
using find with find
Code:
find $dirname -type d -print 2>/dev/null | while read nam
do
echo $nam\/
cd $nam
find . \( ! -name . -prune \) -type f -exec ls -l {} \; |awk '{n=split($9,a,"/"); print a[n],$5,$6,$7,$8}'
done
|
|||
| Google The UNIX and Linux Forums |