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.
And there is a trivial solution to your problem - just not with the tools that you have available on your system, which complicates things.
Um do you mean because of old (RHEL) distribution, or do you mean higher level languages? We have Perl (5.8.5), PHP (4.3.9) and Python (2.3.4) all running on this server - would one (any one?) of those been better for this?
Um do you mean because of old (RHEL) distribution, or do you mean higher level languages? We have Perl (5.8.5), PHP (4.3.9) and Python (2.3.4) all running on this server - would one (any one?) of those been better for this?
I'm an old NetWare admin, forced, though not unwillingly, to re-skill as a linux sys admin - so while I've been at this a little while now, there is so much to learn.
I want to learn perl (I've even recently bought a couple of O'Reilly perl books), but reality is at the moment I can't programme in it ... AND I thought I was close in my original little shell script and that I would just need a couple of little pointers to get me on the right track.
I didn't start this expecting anybody to write a script for me, and I'm sorry that it turned out to be far more involved than I thought - though I'm pleased that I have a result that I can apply to our system to fix quite a few poorly named directories.
I'm an old NetWare admin, forced, though not unwillingly, to re-skill as a linux sys admin - so while I've been at this a little while now, there is so much to learn.
I want to learn perl (I've even recently bought a couple of O'Reilly perl books), but reality is at the moment I can't programme in it ... AND I thought I was close in my original little shell script and that I would just need a couple of little pointers to get me on the right track.
I didn't start this expecting anybody to write a script for me, and I'm sorry that it turned out to be far more involved than I thought - though I'm pleased that I have a result that I can apply to our system to fix quite a few poorly named directories.
You were not learning. You were running code written by others and reporting back problems.
Learning is implementing the task step by step and debugging should problems occur.
Debugging is finding the first place in the flow which behaves not as expected and finding out why.
provided in this earlier post? This only failed because the OP has an old version of find and another version of rename.
If there is a simpler solution with perl then please, by all means, provide it. We are all eager to learn.
Yes, I tested it against directory 'dir' on my system. So to avoid confusion I renamed the variable to 'dyr'. Forgot to change it back before copy+pasting.
provided in this earlier post? This only failed because the OP has an old version of find and another version of rename.
If there is a simpler solution with perl then please, by all means, provide it. We are all eager to learn.
I'm saying it again, this whole thread looks very much like a soap opera.
For example, regarding
Quote:
This only failed because the OP has an old version of find and another version of rename
- GNU 'findutils' as well as GNU 'coreutils' and apparently 'util-linux' depend on "nothing" (i.e. depend on standard "C" library) and can be compiled and installed into a directory of choice using the standard
./configure --prefix=/whatever/desired/prefix
make
make install
sequence.
No programming experience is necessary to run the above sequence.
I'm saying it again, this whole thread looks very much like a soap opera.
For example, regarding
- GNU 'findutils' as well as GNU 'coreutils' and apparently 'util-linux' depend on "nothing" (i.e. depend on standard "C" library) and can be compiled and installed into a directory of choice using the standard
./configure --prefix=/whatever/desired/prefix
make
make install
sequence.
No programming experience is necessary to run the above sequence.
As the OP stated, he has only little experience with linux. So compiling is out of the question.
Further you criticized that bash is not suited for that task at all.
Quote:
replacing three characters and renaming a directory is trivial in any programming language.
and
Quote:
Why 'bash' ?
So again, please show us a simpler and more elegant solution with perl.
Unless you don't want to in order to keep the soap opera going. Well, at least we keep you entertained.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.