=== TheMetamorphosis is now known as Metamorphosis | ||
=== FrankF1 is now known as FrankF | ||
rtn0 | hi | 05:19 |
---|---|---|
rtn0 | how can i rename more than one file, via some sort of regex? | 05:19 |
rtn0 | for example, if i have "file 1.txt" and "file 2.txt", both in the same dir, but i want to rename them by replacing the spaces in the filenames with underscores _, then how would I most efficiently go about it? | 05:19 |
rtn0 | (so they would now be file_1.txt and file_2.txt. this is what i am trying to do.) | 05:19 |
rtn0 | is there a command line command for that? | 05:19 |
rtn0 | thx in advance. | 05:19 |
guiverc | rtn0, the rename command will do that | 05:20 |
rtn0 | guiverc: okay. TU. so what syntax would i use in the theoretical example above? can rename take more than one file like that? | 05:21 |
rtn0 | like can i tell it "rename, I would like you to replace every space with an underscore instead, pls"? if so, what syntax to do so | 05:21 |
guiverc | `rename 'regex' filename` is the rough syntax... | 05:22 |
guiverc | `rename s/\ /_/ *` maybe is a quick example | 05:23 |
guiverc | (though I'd test it first, I've not used rename in some years) | 05:24 |
rtn0 | okay so whatever comes immediately after the s/ is the thing to be replaced with something else, and after the next / comes what you are repacing it with? | 05:25 |
rtn0 | is that correct? | 05:25 |
rtn0 | guiverc: so IOW, s/a/b/ would replace a with b? | 05:26 |
rtn0 | and $rename s/a/b/ * would theoretically replace every occurence of the letter a in names with letter b, correct? | 05:26 |
guiverc | I'd suggest reading the manual (man rename) first.., and as I suggested I'd create a sample directory with like filenames & test there first to ensure you've understood it | 05:26 |
rtn0 | guiverc: ok np. thx agn. | 05:27 |
rtn0 | brb. | 05:27 |
rtn0 | i will let u know if successful. | 05:27 |
rtn0 | guiverc: ok i tested it. | 05:32 |
rtn0 | woot! | 05:32 |
rtn0 | it works, thank you very much guiverc. | 05:33 |
rtn0 | :) | 05:33 |
rtn0 | im still pretty new to linux. 6 months experience. still learning. | 05:33 |
rtn0 | This is something I have been curious about from the beginning, just haven't had a chance to get around to learning it until now, cuz ive been so busy learning other things -- like 100 things per day. :p | 05:34 |
rtn0 | drinking from a fire hose. | 05:34 |
rtn0 | gnite all | 06:10 |
smm_ | hello | 09:47 |
=== root is now known as Guest87226 | ||
=== raj_149 is now known as raj_ | ||
marci | hi all! | 17:56 |
marci | installed my ubuntu macbook laptop 3gbyte and ssd drive, very fast :) | 17:57 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!