Any clues on how to parse a line returned from an ls command that allows for the filename to be fully passed even if it includes spaces? What I got close with is:
ls -ltra | awk '{print $1 "|" $3 "|" $4 "|" $5 "|" $6 "|" $7 "|" $8 "|" $9 $10 $11 $12 ... (etc)}'
However this clears the spaces in the filename and metls the name... Basically anything beyond the 9th field can be lumped into one variable for full printing or whatever...
you can use for loop inside awk starting from field 9, since file names from ls -ltr output starts at field 9
eg
.... | awk '{
for ( i=9 ; i<=NF;i++) {
# find some way to concat to become file name
}
}'
and unless you want to do some other things with the various columns of ls -l , you can do away with -l (or use -1 ) instead to just get the file name.
ls -tra | ......
or
for files in *
do
# do something with "$files"
done
Thanks, the for loop cleans up the processing as does using OFS for the output delimiter. The problem is still the filename or at least being able to determine the starting location of the filename for use in a substr operation....