I am in the process of answering a request for tender on a contract that requires a decent amount of text processing. The main trouble is that the customer wants to be able to run this on any UNIX (HPUX, Solaris, AIX, FreeBSD) or Linux (SLES, RHEL) platform, which may constrain what I use to do it. They don't want to make the installation of extra tools a pre-requisite.
I'm torn between Perl and awk. I know that Perl is an ideal tool for processing text (and I'm reasonably adept at it) but, before I put in the RFT response that Perl will be required, I'd like to find out if anyone is running on a platform where Perl is not installed by default.
It'd be handy to list those platforms in the RFT and give the client the option of which way they want to go. I have a vague recollection that it's not on FreeBSD in the default install and it may also be that the non-Linux platforms also don't have it.
Any other tools can be suggested but, given my familiarity with Perl and awk, they'll probably be the only ones on the shortlist.
You can get a version of Perl compiled for just about any unix variant. Perl doesn't have to be 'installed', but can run inside of your application's directory. I would bundle Perl with my distribution, so you can ensure you're running the same version.
It is very difficult to write a completely cross platform shell script, without testing on the target OS. If you develop an awk script, you are probably going to develop using the GNU variant on Linux, which is a superset of the POSIX awk. I'm often configuring opening source packages on Solaris, and I'm constantly finding issues where people assume your running a modern version of a tool. For example, on Solaris bash is not the standard bourne shell (/bin/sh), and echo does not take any parameters. If you do try to code with POSIX awk, you may find yourself limited by the regex library, or out dated conventions.
Perl's artistic license allows you to bundle it with your program, as long as you follow a couple of simple things like keeping the copyright in tact.
Almost every *nix (except some for very limited disk space) has Perl installed. AFAIK, even FreeBSD. Just in case it isn't, you can transform Perl program into an executable that will not need perl with PAR::Packer.
If the client does not have Perl on their machines you can always use Par::Packer to create an executable for that platform. This also means that you don't have to worry about using modules, since they will be included in the executable as well.
even if Perl might be installed on almost every *nix platforms, they might not be the same version , so be aware of this. With the requirement that it needs to works on most *nix, you can just code with shell+ utilities. For parsing files, awk+shell can do the job as well. you just have to write it in a "portable" format. check this out for more info
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With