OS: RHEL 5.8
shell: bash 3.2.25
Directory /home/guest/ contains these files:
file a
file b
file c
fileD
fileE
fileF
testFile.txt
I'm trying to find the syntax to run
ls -ltr
against this list of files that is contained within a text file, testFile.txt.
The file testFile.txt has the contents below, with file names within quotes and with files space delimited.
"/home/guest/file a" "/home/guest/file b" "/home/guest/file c" "/home/guest/fileF" "/home/guest/fileE" "/home/guest/fileD"
All attempts are failing upon encountering whitespace.
1.
ls -ltr `cat testFile.txt | xargs -0`
ls: "/home/guest/file: No such file or directory
ls: a": No such file or directory
ls: "/home/guest/file: No such file or directory
ls: b": No such file or directory
ls: "/home/guest/file: No such file or directory
ls: c": No such file or directory
ls: "/home/guest/fileF": No such file or directory
ls: "/home/guest/fileE": No such file or directory
ls: "/home/guest/fileD": No such file or directory
- Same error from
ls -ltr `awk '{print}' /home/guest/testFile.txt
- Same error from
cat testFile.txt | while read i ; do ls -ltr $i ; done
Any assistance would be greatly appreciated. Thanks!