Ok. . . Well, there are ways and ways of doing this. . .
awk and sed are good to read up on, but without reading about regular
expressions, they won't mean much. . .
Get an O'Reilly book on regex, sed, awk, etc. . .
Here's a very dirty, inelegant, way to do what you want:
Code:
ls * | sed s/\ /_/g | awk '{ print $0,$0}' | sed s/_/'\\'\ /1 | sed s/_/'\\'\ /1 | grep _ > mvfiles
source mvfiles
It's dirty and inelegant because:
We first change all spaces to "_", pipe that to awk, which prints each
line twice, pipe that to sed, which converts the first "_" to "\ ", pipe that
to sed, whcih converts the second (really the first it sees) "_" to "\ ",
pipe that to grep to just pull out the lines with an _ in them, redirect the
output to a file, then source the file. This will only work for filenames
with two spaces in them. . . You'd have to find a better way to do this
that involves not caring how many spaces there are. You can do it in
awk, PERL, or whatever. . .
The above is really just an example to get you started, since it will not
work if filenames only have one space, since it would end up changing
both underscores back to spaces. . .