[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Bash read specific element from csv
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] Bash read specific element from csv |
Date: |
Wed, 8 Oct 2014 08:44:04 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Tue, Oct 07, 2014 at 11:46:40PM +0200, Phil wrote:
> Unfortunately, the system I am using runs Bash 3.2. I am currently
> searching Bash 3.2 equivalent to associative arrays. It appears that
> I have somewhat a bone to chew on to find a working equivalent.
In this environment, you could rewrite the code in awk. Awk has
associative arrays. Perl would also be a good choice (using hashes).
Failing that, you could do a linear search through a non-associative
array (month[9]=Sep) until you find the matching string. It would be
less efficient, but since there are only 12 months, it's not terrible.
Or, since you said that the translation of "Sep" to "09" was optional,
you could simply skip this step.