I got one simple TXT file with long file name with blank spaces in between the words. I am trying to display that full file name, but it breaks while displaying. Could somebody shed some light here?
Script
------
for i in `cat ~\temp\employee.txt`
do
echo $i
done
My job will be complete when i delete the files under DOCS folder, those filenames which i am retreiving from the TXT file. Below script does not seems to work to delete. Please advice.
Script
cd ~/docs/
while IFS="\n" read line
do
echo "$line"
rm $line
done < ~/temp/employee.txt
Then you must have another problem besides embedded spaces in a filename. Double quotes will fix that:
$ echo testfile > "a b"
$ cat "a b"
testfile
$ name="a b"
$ cat $name
cat: cannot read from file a : Is a directory
cat: cannot open file b : No such file or directory
$ cat "$name"
testfile
$ rm $name
rm: a: is a directory
rm: b: No such file or directory
$ rm "$name"
$