I believe there's a simple fix but cannot debug it out.
I have file called "file name with space
"
How do I cat
this file from Linux bash ?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityDoes putting quotation marks around the name not work?
cat "file name with space"
A third option would be
cat 'file name with space'
where the file name may contain everything but the '
.
If it does, such as file n'ame
, replace every '
with '\''
:
cat 'file n'\''ame'
I have run into this problem on Linux and in Cygwin. The one thing I found that works is to enclose the name in double-quotes and to replace non-traditional characters with asterisks. For example:
tail File.basename.Job With Spaces.log
becomes...
tail "File.basename.Job*With*Spaces.log"
I tried escaping the spaces with backslashes, whether unprotected, protected with double-quotes, or protected with single-quotes, and in all cases tail parsed the names at the spaces as though unprotected.
for i in
cat bakuplocations; do cp -u "$i" .; done
) Then, if the filenames have spaces it will not work any of the other suggestions except this one.
May 15, 2019 at 19:20
while read i; do cp -u "$i" .; done < backuplocations
.
cat "file name with space"
orcat file\ name\ with\ space
cat "file with space"
doesn't work!? Good luck.file_name_with_underscore
...