ntang (ntang) wrote,
ntang
ntang

  • Mood:

Cheaters never prosper.


hi

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

boby


My response:

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

Nicholas

(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.)
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments