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.

Required fields*

7
  • 1
    awk from version 4.1.0 has an inplace option. You need to check with awk -V. Commented May 16, 2016 at 15:02
  • That's a very unusual file format - every product line would have to have the sum column recalculated whenever any matching product line is added or updated. What are you going to use that file for after the sum column has been added? And how are you going to use it? Are you sure that that's actually the best way to do whatever it is that you're really trying to do? Commented May 16, 2016 at 21:51
  • Lines won't be added or updated, but the names in column A and B can be completely different, which i cannot catch with any regexp. Those files are an exported result of daily proccesses. I need to make a few batch changes on them and then pass it to client, which later maps it. So I'm kind of forced to this. Commented May 17, 2016 at 7:39
  • Of course, i'm forced to get that kind of output, not the means. Commented May 17, 2016 at 13:44
  • If you want one command, make this into a proper shell script. Don't get too hung up on reducing the number of lines, characters, steps, etc., lest you loose readability and maintainability. Step-by-step code is also easier to debug. FWIW, YMMV. Commented May 17, 2016 at 18:31