http://www.perl.org ...
Use the right tool for the job. When you have a
cornucopia of general-purpose text manipulation languages available in the Linux environment ... which you do not have in Windows and therefore might not be used to ... there's frankly very little reason (if any, IMHO) to use "shell scripts."
Continuing most-briefly on this soapbox, "bash scripting may be fine for stringing simple commands together," and it certainly
can be used to do many things. Well, you can probably open a can of sardines with a (non-Swiss Army) pocket knife, too... but you're likely to cut your hand while doing it, and meanwhile your camping partner who thought to bring a can-opener with him has already finished eating.
The Unix/Linux environment was first conceived-of in the 1970's by "tool makers," and it can take years to discover the richness of tools that are "right there, free." Now, I'm
not a Perl fanboy, but I know a good idea when I see one, and Perl
is a prime example of this kind of reasoning. A guy named Larry Wall, who had a problem more-or-less
exactly like yours, found an existing tool (called
awk ... and which you
also have at your disposal...) to be deficient. So, he wrote a better tool and dubbed it "perl." He put what he thought needed to be in it, into it, into it. Since then, a whole bunch of other nerds,
also with problems to solve, ripped out what seemed to be bad-parts and put what
they thought needed to be in it, into it. They're all still busy at it.
So the bottom line is that, today, you've got this
incredibly powerful tool right at your fingertips, with literally millions of lines of well-tested software that you can just plunk right in to whatever you happen to be doing. And, this being Unix/Linux, there are so many
other powerful tools to choose from ... Ruby, PHP, Python, Scheme ...
all free.
So... don't monkey around with "bash scripting" too much. Learn how to use it competently, to be sure, but also bear in mind that it not
designed to be a general-purpose programming language.