ntang (ntang) wrote,

  • Mood:

Cheaters never prosper.


would you please tell me the best solution for the following question ? with awk command ?

2. Write a script called "inventory" which is used to increment
or decrement an item's quantity in an inventory file. Assume
that the item name is in column 5 (the last column), and the
quantity is in column 2. There are 3 arguments: the name of
the inventory file, the name of the item, and a number which is
positive for an increase and negative for a decrease. For example,

$ inventory invfile1 pencils -27

would decrease the quantity of pencils by 27 in file invfile1.
Issue error messages if the script is called with anything other
than three arguments, and if the item cannot be found in the
inventory file.

Hint: Use Awk command

thanks for your help


My response:

I think the best solution would be for you to do your own homework.


(It was either that, or give him a completely wrong but still convincing answer - and that, while infinitely more just, would also have taken more than 30 seconds.)

  • Where I am nowadays

    I haven't updated this in a million years... in case you're wondering why, it's because I've mostly moved on to other places. You can find my…

  • DSL

    I've been a loyal Megapath customer for years. (Something like 8 or 10, crazy, in that range...) They've had great service (and a great service -…

  • MySQL failover

    So we're running some MySQL at work, which is a little unusual for us, but is probably long overdue. (Specifically, it's for some Wordpress…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded