ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Yes. The easiest way to do it is with bash (though you'll probably dip a bit into sed along the way). This could be your portal to having fun with shell scripts!
Do this at the command line:
Code:
man bash
Concentrate on the for statement. Write a script that does as much as you can, and play with it a bit. When you have a question, come back to this thread, post your question, and we'll take it to the next step.
Geez, you guys never heard of the 'rename' command?
Code:
$ rename fmtchanged fmt *.fmtchanged
I certainly have (and have advocated it more than once);
but debi(li)an and its derivatives have a perl-script
by the same name instead that works quite differently.
but debi(li)an and its derivatives have a perl-script
by the same name instead that works quite differently.
Ahh, it becomes clear now...
On a ML I subscribe to a fellow asked for help with rename. He was trying to give it a PCRE and I informed him that rename wants three arguments. He responded that he had read the manpage and was aware of that. Seems he had found some (Debian) tutorial that used the PCRE 'rename' hence his confusion, and the 'real' rename's failure.
Although I have no doubt the Perl version may be very powerful, I don't think it is wise for Debian et al to overwrite apps from the util-linux package. Did they clobber cal and agetty with a Perl version as well?
Anyway, I just thought it was odd that after 6 posts and several shellscripts no one had mentioned rename, so I did...
Although I have no doubt the Perl version may be very powerful, I don't think it is wise for Debian et al to overwrite apps from the util-linux package. Did they clobber cal and agetty with a Perl version as well?
I believe the Perl version preceded the other version, so it is util-linux that overwrote an existing (in some distros) command.
Whichever it was, it is a non-standard command, and is not portable. I avoid it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.