How would I get awk to output the whole file name in ls -l
if some of the files have spaces in them. Usually, I can run this command:
A solution is to encode & decode the space with a word or character by using sed:
ls -l | sed s/\ /{space}/ | awk '{print $9}' | sed s/{space}/\ /
This will replace all spaces in a line with {space}
before passing it to awk. After the line has passed to awk, we replace {space}
back with space.
find
as stated by others is a much better solution. But if you really have to use awk, you can try this.