[conspire] How automatically replace control (newline) character with space in file & directory names
Hereon
hereon1 at fastmail.us
Sun Dec 4 14:45:24 PST 2005
Can someone tell me a way to accomplish this with a command, commands,
shell script, or other program?
I have some files & directories with names that contain the newline
character, \n , 0A hex.
[These get created sometimes as I copy & past text from web pages into
the filename as I save a webpage, from firefox, to disk.]
I wish to replace that newline with a space character, automatically,
without doing it by hand for each file.
I have figured out one way to locate the files:
In the home directory do:
ls -QR * | grep '\\n'
Then, individually, I can do a locate on part of the file name to get a
full path.
====
$ ls -QR | grep '\\n' > FilesWithNewline.txt
$ cat FilesWithNewline.txt
. . . [Many file or directory names listed, like the following lines:]
"An elevator to space NASA gives idea a lift\n12 teams vying for
$100,000 in prizes in Mountain View article.cgi.html"
"An elevator to space NASA gives idea a lift\n12 teams vying for
$100,000 in prizes in Mountain View article.cgi_files"
"./Engineering/Space/An elevator to space NASA gives idea a lift\n12
teams vying for $100,000 in prizes in Mountain View article.cgi_files":
"./Engineering/Space/An elevator to space NASA gives idea a lift\n12
teams vying for $100,000 in prizes in Mountain View
article.cgi_files/B1654090_data":
. . .
====
So, what's an easy way to search through the file tree & automatically
replace the '\n' with a space character?
Also, is there a better email list to ask this question? Perhaps one
whose readers are very familiar with shell scripting?
Thanks.
--
Hereon
hereon1 at fastmail.us
--
http://www.fastmail.fm - Same, same, but different
More information about the conspire
mailing list