spacing problem

Hi guys, I have this little code:

for directory in / $(echo $path | tr '/' ' ' )
do
cd $directory
echo "$(ls -ld | cut -c2-10 | sed 's/.\{3\}/& /' | sed 's/.\{7\}/& /' |
sed 's/.\{1\}/& /g')" " $directory"
done

The output of this will be showing the permissions with spaces so it will look something like this:

r w x r - x r - x /
r - x r - x r - x home
r w x - - x - - x anydir
r w x r - x r - x somedir

So these spaces aren't enough for me. I need spaces after every line, so I want the output like this:

r w x r - x r - x /

r - x r - x r - x home

r w x - - x - - x anydir

r w x r - x r - x somedir

I am not sure how to modify my loop so it looks like that.

Any help would be appreciated.

Thanks

Maybe add this with a pipe:

awk '{print $0"\n"}' infile
r w x r - x r - x /

r - x r - x r - x home

r w x - - x - - x anydir

r w x r - x r - x somedir

Hi,

In my opinion

r w x r - x r - x /
r - x r - x r - x home
r w x - - x - - x anydir
r w x r - x r - x somedir

cannot be the output of your commands:

you insert a space after 3 and 7 characters. The you replace every character by itself and a space. This should be your output:

r w x   r - x   r - x /
r - x    r - x   r - x home
r w x   - - x   - - x anydir
r w x   r - x   r - x somedir

If this is what you want.

sed 's/^\(...\)\(...\)\(....\).*/\1 \2 \3\n/;s/./& /g'

delete everything except the first ten characters, then insert a space between the first two fields and afters this doublespace the line and insert a newline after it. Perhaps you should describe want you want to achieve.

HTH Chris