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.
So, I've been using linux for a long time now, but have avoided programming because it makes my head hurt a little bit.
I often have some tasks that i KNOW would be very easy if i could write simple programs to automate things. For example, right now i wish i could write a simple program to search/replace specific simple text strings within many multiple text files.
I am VERY comfortable with CLI, but i just FAIL to successfully endeavor to write scripts/programs.
So my question is, now that i am seriously considering the effort:
Since i will never be a programmer, professionally, and since i just want some skills to accomplish random tasks from time to time:
What should i endeavor to learn amongst the following skillsets:
As an adjoinder, it would be a bonus for me if the option i should undertake would become a foundation for a broader usefullness down the road - ie - is any of these choices more extendable towards future undertakings.. (?)
Just looking for experienced advice in this context.
Many thanks in advance to you fine folks,
cheers.
danimal
the only thing I can say is just start to implement your first app and collect all the information you need to complete it. read man pages and tutorials about similar tasks, post your tries and we will gladly help you discuss it.
the first tool should be bash and the basic toolset: grep, sed, ls, ....
Bash will get you aquaintaned with basic programming concepts. Like loops variables and functions. Not talking syntax here due to bash from my perspective is a bit of from other programming languages when it comes to the characters used. And there are o so many different ways to write one and the same thing. Also this holds true for most other programming languages.
Perl would be the next step in my opinion cause most distributions bring it natively. Another point for perl is the massive load of libraries you can find on cpan.org. So if you want some bigger projects this might suite quite well.
As I only used python for blender I can't tell you mutch about it and if its suited for system tools. But what I know that its quite capable itself and easy on the syntax.
My standard advice to anyone starting to program is pick a language, (almost) any language, grab some basic documentation a tutorial (or two, or three...), and start writing. Having programmed in many languages while mastering few, I'm always searching docs and tutorials for assistance and useful tidbits.
For the specific problem of search/replace in multiple files, I'd go with pan64's recommendation
Seeing as the usual shell env on Linux is normally bash, I'd recommend starting with that and associated one liners from sed, awk.
Later on, probably Perl for longer/more complex tasks.
(Of course others will suggest their own favourite langs.)
One piece of advice; start with very short/simple scripts and only try to write & debug a few lines at a time.
Don't(!) try to write eg a 20 liner and then debug it into existence/working condition.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.