Search Results

Showing results 1 to 11 of 11
Search took 0.00 seconds.
Search: Posts Made By: stilllearning ; Forum: Shell Scripting and child forums
Forum: Shell Scripting Dec 4th, 2007
Replies: 23
Views: 5,419
Posted By stilllearning
The '|' character is a pipe. Basically what it does is send the output of one command which would otherwise go to stdout, in as the input to the next command.

The final sort and print doesn't...
Forum: Shell Scripting Dec 4th, 2007
Replies: 23
Views: 5,419
Posted By stilllearning
Sorting a delimited file

for example if your record is and you want to sort it by the 3rd field,

a:b:c

sort -t':' -k 3

To sort it in numeric order add a -n to the line
Forum: Shell Scripting Dec 4th, 2007
Replies: 23
Views: 5,419
Posted By stilllearning
You could make this much easier :)

Once you have your output file with the values, all you really need to do is cat the output and pipe it into the sort. <Check the man pages for the sort and...
Forum: Shell Scripting Dec 3rd, 2007
Replies: 23
Views: 5,419
Posted By stilllearning
Position works the same way as name does. You need to get the final field which is the position for that particular id, and not for a character string at the end of the line. That'll get you all the...
Forum: Shell Scripting Dec 3rd, 2007
Replies: 23
Views: 5,419
Posted By stilllearning
I usually declare the arrays at the top of the script.

Something like this perhaps ? It uses 2 arrays one to store the names and the other to store the sales values.

I am not sure why your awk...
Forum: Shell Scripting Dec 3rd, 2007
Replies: 23
Views: 5,419
Posted By stilllearning
You have the correct idea, but a couple of things.

1. When you extract the name from the associates file you also need to use the ID as a pattern to get the correct name.

2. You can declare the...
Forum: Shell Scripting Dec 3rd, 2007
Replies: 23
Views: 5,419
Posted By stilllearning
Well, in basic bash scripting you cannot add floating point numbers, and i assume your price is floating point.

So in order to add those numbers you need the bc command to do this, hence the...
Forum: Shell Scripting Dec 3rd, 2007
Replies: 23
Views: 5,419
Posted By stilllearning
It will be easier for you to debug this, if you break it up into smaller scripts to make sure each part is being done correctly.

A couple of things. $$ is usually the process id of -bash, so you...
Forum: Shell Scripting Dec 3rd, 2007
Replies: 23
Views: 5,419
Posted By stilllearning
You accidentally removed the $ before the QUANT. Put that back in, and you'll be fine.
Forum: Shell Scripting Dec 3rd, 2007
Replies: 23
Views: 5,419
Posted By stilllearning
Your syntax errors are because of these 2 lines.

TOTAL=${echo "scale=2; $PRICE*QUANT" | bc)
echo "Associate 2$ID made $TOTAL for selling $PRODID


They should be (Need a ( bracket in line 1 ...
Forum: Shell Scripting Dec 3rd, 2007
Replies: 23
Views: 5,419
Posted By stilllearning
Ok, I think this is roughly what you are looking for. You will still need to fine tune it to get the final answers you need. Some parts are hard coded, like assuming your associate id's range from 21...
Showing results 1 to 11 of 11

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC