Help with AWK problem
Hi everyone!
Im new to the forums but was just wondering if someone could help me...
What I ahve is a bash script that has 4 options. The menu is as follows:
MAIN MENU
1. Sales Report
2. Add Sale
3. Add Customer Payment
4. Exit
Enter item number: 2
I'm stuck on add sale and add customer payment. Add sale is the following which is the output of what is entered. The database file is the first argument for the script (so $1)
Enter full customer name: Linus Torvalds
Enter item price: 1
Enter item quantity purchased: 10
Done...
PRESS <ENTER> TO CONTINUE
What I have to do is either two of the following things after Done... is echo'd
1 - Customer is not on file: Just add the customer Name, and total Sales amount at the bottom of the database file.
2 - Customer is already on file: Find the record containing the customer name. Add the existing total sales with new total sales just calculated. Replace the total sales amount for the customer with the newer calculated total sales.
For "Add Customer Payment", the script will prompt the user for a Customer Name and a Total Sales amount. If there is no match of either Customer Name or Total Sales amount, then a message "No Match Found" should be displayed, and wait for the user to press to return to the menu. If there is a match for both Customer Name and Total Sales amount, then the existing total sales is reduced by the payment amount and the new total sales amount is placed in the database file.
I really need help as my AWK isn't that good...
Thankyou!
|