If you want 2 or more spaces, then:
grep -E "\s{2,}" ${dname}.txt >> ${dname}_error.txt
The reason your template doesn't work is because of the quotes inside. \s
used for [space]. You could do the same:
grep -E ' +' ${dname}.txt >> ${dname}_error.txt
But it's hard to say exactly what you are looking for with this version. \s\s+
will also work, but \s{2,}
is the most concise, and also makes it possible to set an upper limit. If you want to find 2, 3 or 4 spaces in a row, you must use \s{2,4}
user918938
source share