[PLUG] Mass Removal of White Space in File Names

Rich Shepard rshepard at appl-ecosys.com
Mon Apr 18 13:41:14 UTC 2011


On Mon, 18 Apr 2011, Rich Shepard wrote:

>   I like the idea of using awk; for whatever the reason I did not see this
> as the most parsimonious solution. I'm probably mistaken, but my
> understanding is that sed would be used within a file to make changes
> line-by-line, while awk can be fed by the 'ls' command.

   Looking at the file names in the two directories, I see that all I need to
identify each one uniquely is the image number. So, for example in one
directory, where there 'Some Long File Name 1.jpg' but the number is
inclusive to 60, I type "ls | awk '{print $5}' and see 1.jpg through 60.jpg
on the console. I'll need to experiment how to insert the non-ubuntu rename
command in this command line so the files are renamed rather than listed.
I'll copy a bunch of files to another directory (but can always replace the
originals from the cdrom disk).

   The second directory is more interesting as each file name has the image
number wrapped in parentheses; I'll need to play with the awk command to
figure out how to strip the parentheses from the number.

Thanks,

Rich



More information about the PLUG mailing list