alternative to readarray, because it does not work on mac os x

后端 未结 7 1999
挽巷
挽巷 2021-01-17 16:55

I have a varsValues.txt file

cat varsValues.txt
aa=13.7
something=20.6
countries=205
world=1
languages=2014
people=7.2
oceans=3.4

And I wou

7条回答
  •  别那么骄傲
    2021-01-17 17:36

    Let's start with this:

    $ awk -F'=' '{values[$1]=$2} END{print values["people"]}' file
    7.2
    
    $ awk -F'=' '{values[$1]=$2} END{for (name in values) print name, values[name]}' file
    languages 2014
    oceans 3.4
    world 1
    something 20.6
    countries 205
    people 7.2
    aa 13.7
    

    Now - what else do you need to do?

提交回复
热议问题