Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

9
  • 1
    Remove spaces around = Commented Sep 15, 2019 at 5:34
  • @muru it worked. would you like to turn it into an answer so i can accept it? Commented Sep 15, 2019 at 5:36
  • 1
    Why not do the whole thing in awk? Commented Sep 15, 2019 at 7:16
  • 1
    @Kusalananda, $ is an operator like any other in awk, there's no problem having spaces around it, not any more than around + or *. Commented Sep 15, 2019 at 8:59
  • 1
    awk is a tool designed for text processing and with associative array support and is much more efficient at it than a shell. So, unless you need to run some commands on the elements of that associative array (a shell is the tool to run other commands, awk does invoke a shell to run other commands for instance), it would make more sense to use awk. Commented Sep 15, 2019 at 9:01