bc


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers bc
# 1  
Old 05-22-2008
bc

file1 has 20
file2 has 10

file1 - file2 = 10

manually, i can:

bc
20-10 = 10

how can i accomplish this with scripting ?

thanks in advance.
# 2  
Old 05-22-2008
use cat n echo cmd and $ as some variable. tats all I can say. no much details given by u dude
# 3  
Old 05-22-2008
Hammer & Screwdriver while not knowing the details, perhaps this will help..

Code:
> val1=20
> val2=10
> echo "$val1 - $val2" | bc
10

Not sure what you are doing that you KNOW two things. Perhaps
>val1=$(cat file1 | wc -l)
which will store the number of lines of file file1 into val1
# 4  
Old 05-22-2008
thank you very much. this is exactly what i need.
 
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question