Art Alexion on 22 Feb 2006 17:03:12 -0000 |
sean finney wrote: >hi art, > >as others have suggested, your problem is expansion of whitespace. > >personally, from experience having learned the hardway, i suggest >you use a method that is immune to not only whitespace, but >other forms of shell expansion problems (like globbing or >variable expansion). > >for example, if you want to do something on all files in a >directory, my preferred method is > >find /dir -type f -print0 | xargs -0 do_something > >(various invocations of find can limit to certain directories, depths, >filenames, etc. various invocations of xargs can limit the number of >args passed to a command, or placement of the args within a command) > >so in your example i'd do the above, substituting do_something with >the rename command suggested by mct. i guess that'd be something like > >find /dir -type f -print0 | xargs -0 rename 's/\s+/_/g' > >keep in mind that this may run the command on the same file multiple >times, but if you're just replacing some chars with others that >shouldn't make any difference. > > Along with moving to learn more about bash scripting, I need to learn the find command better. Thanks, Sean. -- _______________________________________ Art Alexion Arthur S. Alexion LLC PGP fingerprint: 52A4 B10C AA73 096F A661 92D2 3B65 8EAC ACC5 BA7A The attachment -- signature.asc -- is my electronic signature; no need for alarm. Info @ http://mysite.verizon.net/art.alexion/encryption/signature.asc.what.html Key for signed PDFs available at http://mysite.verizon.net/art.alexion/encryption/ArthurSAlexion.p7c The validation string is TTJY-ZILJ-BJJG. ________________________________________ Attachment:
signature.asc ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|