Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

How to multiply two numbers on the same line in a loop?

$
0
0

Here is my data below...How would I multiply the first multi-digit number by the second multi-digit number that is separated by a space line by line, and the result either replace those equation values or output them to a new text file? I am using Powershell v2, I know it's old, but I am on a production machine and there is too much already written scripts that still need to be updated before upgrading. Any ideas would  be much appreciated as I am not a wiz at this.

12469 60
 4101 60
 3798 1482
 2518 60     
 1973 60      
 1819 66               
 1698 60            
 1531 60
 1303 66   
 1117 1482  
 1052 100     
  999 90        
  900 60
  881 74       
  837 60
  702 66
  639 60
  590 60    
  573 66
  563 60   

I need to figure out how many bytes are uploaded, the first number is the number of frames(packets), and the second number is the number of bytes for one packet. So the results will be total bytes uploaded for each line and/or node on our network.


Viewing all articles
Browse latest Browse all 6937

Trending Articles