I'm trying to line up (align) output from "ls -l". I have the following awk command in a script that writes to a file (INFILE has bunch of file names):
#!/bin/sh
for LINE in `cat ${INFILE}`
do
echo `ls -l $LINE | awk '{printf ("%s %s:%s \t %s\n",$1, $3, $4, $9) }'` >> ${FORMATTED}
done
The output come out like the following:
-rwxr--r-- one:groupone /home/userone/fileone
-rwxr---w- three:groupthree /home/userthree/filethree
-rwxr----x twenty:grouptwenty /home/usertwenty/filetwenty
I want them to look like:
-rwxr--r-- one:groupone /home/userone/fileone
-rwxr---w- three:groupthree /home/userthree/filethree
-rwxr----x twenty:grouptwenty /home/usertwenty/filetwenty
Any ideas on how I can do this?
Thanks!
#!/bin/sh
for LINE in `cat ${INFILE}`
do
echo `ls -l $LINE | awk '{printf ("%s %s:%s \t %s\n",$1, $3, $4, $9) }'` >> ${FORMATTED}
done
The output come out like the following:
-rwxr--r-- one:groupone /home/userone/fileone
-rwxr---w- three:groupthree /home/userthree/filethree
-rwxr----x twenty:grouptwenty /home/usertwenty/filetwenty
I want them to look like:
-rwxr--r-- one:groupone /home/userone/fileone
-rwxr---w- three:groupthree /home/userthree/filethree
-rwxr----x twenty:grouptwenty /home/usertwenty/filetwenty
Any ideas on how I can do this?
Thanks!