Question about linux rename command
I realize that this is a very basic question, but i'm stuck about the syntax on the rename command. I understand the command syntax except for one thing in it. The syntax is rename 's/OLD/NEW' FILES. My question (and i can't find the answer anywhere) is what does the "s" represent in the command?
A simple question, but bugging me because i can't seem to find a meaning for what the "s" stands for. If any one knows, please let me know.
Thanks.
A newbie to linux.
A simple question, but bugging me because i can't seem to find a meaning for what the "s" stands for. If any one knows, please let me know.
Thanks.
A newbie to linux.
Comments
-
JerryL Member Posts: 96 ■■■□□□□□□□Thanks for the reply. From what i understand, the differences between mv and rename are that mv is used to usually move or rename single files. Rename is used to rename multiple or groups of files.
-
devils_haircut Member Posts: 284 ■■■□□□□□□□I believe the 's' comes from Perl syntax, which is way beyond anything I know.
-
Bokeh Member Posts: 1,636 ■■■■■■■□□□Perhaps this may help
perl - Rename - what does s// vs y// mean? - Ask Ubuntu -
TBev0 Member Posts: 23 ■□□□□□□□□□I also usually use the mv command, however my guess would be that the "s" stands substitute, as the syntax is similar to the sed command.
-
JerryL Member Posts: 96 ■■■□□□□□□□Wow. That is buried down. I thought that this would be a very simple question. From what i can figure out from the link that Bokeh gave, it means "search and replace". If that's the case, it makes sense because renaming file(s) is really searching them out and replacing them. Now that i have the full syntax broken down, it actually makes more sense. At least with me, if I understand the syntax, then that is more than half the battle.
Thanks everyone from a linux newbie who's just at the beginning of the path. -
ratbuddy Member Posts: 665S stands for substitute, and it goes back way farther than Perl. sed (do you capitalize an uncapitalized proper noun at the beginning of a sentence?) and vi can both use forms of s/whatever/whatever, and they were written in the 1970s
-
JerryL Member Posts: 96 ■■■□□□□□□□Hmmm. Thanks for the update. I stand corrected. Either way, once you learn the full meaning of the syntax, things fall into place. At least for me they do.
-
pram Member Posts: 171Useless unix history here, but it goes back even further than sed! It came from ed (sed is a non-interactive derivative of ed) which was written by the father of unix himself, Ken Thompson.
-
JerryL Member Posts: 96 ■■■□□□□□□□Scary thought... I might actually learn something through this. Thanks guys for the help on this. I'm sure that there will be more questions coming along.