↧
Answer by Jesse_b for How to save keys and values from a text file into two...
Assuming your input file has every name/score combo on a newline this should do what you need: while read line; do names+=($(echo "$line" | awk '{print $1}' | tr -d ':')) scores+=($(echo "$line" | awk...
View ArticleHow to save keys and values from a text file into two separate arrays?
I have a text file for keeping game scores, the format is thus: Name: score Using a Bash script, I'm trying to place the names in one array and the scores in another. My first approach used the cut...
View Article