Using for loops and Arrays
Certain languages, such as Spanish and French, have the concept of masculine and feminine nouns. For this demo, we’ll work with a list of English nouns, their Spanish equivalents, and the gender designations for the Spanish nouns.
Why is someone with a French last name creating a list of Spanish words? Well, it’s just that despite my French ancestry, I chose to learn Spanish instead of French in high school. So, I do know some Spanish, but I don’t know French. (I know, I’m weird.) Also, I realize that the Spanish word camiόn has an accent over the last syllable. Alas, inserting accents with an English-language keyboard isn’t easily done in a plain-text file, at least not without messing up how the awk
script works.
To begin, create the spanish_words.txt
file, and make it look like this:
ENGLISH:SPANISH:GENDER
cat:gato:M
table:mesa:F
bed:cama:F
bus:camion:M
house:casa:F
As you see, we&...