Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
The end bit is where the problem arises - essentially I want to take full pathname (ie. {}) and convert it into name which is acceptable as a filename (ie. replace / with - or something similar). Any ideas/clues.
To save time, all the other parts work, the find will return all the paths, khtml2png works and if replace the output name with a fixed term it goes through and converts each file to thumbnail, just overwriting each time. But the main point is that the out files must be named to relate to the location of the source document.
Have now spent 5 hours tinkering with this, so any request I read the manual or google, please be more specific (ie. which man or which search time) as I've seen many searchs on the web have ended with a 'google it' recommendation and I'm feeling the urge to scream everytime I see it! ;-)
The major problem you're facing is copying a string, and then only changing one instance of it. There are plenty of tools for changing every instance of a string, tr, sed, xargs -i, but since you need to keep a hold of the original as well, you'd need to store it somewhere else while the translation is happening, and bash isn't too happy with evaluating find's {} inside of a `` (or similar).
It'd be pretty simple for Perl to do the entire job, rather than just the translation, but keeping the original find in place, and having perl just call khtml2png keeps things relatively simple to modify.
Thanks! Worked a treat, I think I had to swap s/\. for s\// - but I could it out from there :-) You've saved me from another few hours of hair pulling :-) [Can't paste exactly, as it's on my home machine]
I suspected that perl held the answer, but knew nothing about it, I'm already looking forward to playing around with it some more :-)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.