The UNIX and Linux Forums
Forum Home
Linux and Unix Man Pages
Search Forums
Search Community Posts
Today's Posts
Quick Links
Man Pages
RedHat Commands
OpenSolaris Commands
Linux Commands
SunOS Commands
FreeBSD Commands
All UNIX Man Pages
All Linux Man Pages
Full Man Repository
Login or Register to Ask a Question and Join Our Community
Search Forums
Show Threads .
Show Posts
Tag Search
Advanced Search
Quick Links
Contact Us
Forum Rules
Today's Posts
FAQ
Pictures & Albums
All Albums
Miscellaneous
What is My IP
Whois
Mark Forums Read
UNIX for Dummies Questions & Answers
bc
Tags
bc
,
beginners
Thread Tools
Search this Thread
Top Forums
UNIX for Dummies Questions & Answers
bc
#
1
05-22-2008
tjmannonline
Registered User
131,
0
Join Date: Apr 2008
Last Activity: 24 June 2011, 11:41 AM EDT
Posts: 131
Thanks Given: 0
Thanked 0 Times in 0 Posts
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.
tjmannonline
View Public Profile for tjmannonline
Find all posts by tjmannonline
#
2
05-22-2008
incredible
Registered User
2,693,
19
Join Date: May 2008
Last Activity: 24 August 2014, 5:15 AM EDT
Location: SINGAPORE.. The "FINE" City
Posts: 2,693
Thanks Given: 1
Thanked 19 Times in 19 Posts
use cat n echo cmd and $ as some variable. tats all I can say. no much details given by u dude
incredible
View Public Profile for incredible
Find all posts by incredible
#
3
05-22-2008
joeyg
Registered User
2,524,
241
Join Date: Dec 2007
Last Activity: 17 March 2020, 2:04 PM EDT
Posts: 2,524
Thanks Given: 173
Thanked 241 Times in 206 Posts
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
joeyg
View Public Profile for joeyg
Find all posts by joeyg
#
4
05-22-2008
tjmannonline
Registered User
131,
0
Join Date: Apr 2008
Last Activity: 24 June 2011, 11:41 AM EDT
Posts: 131
Thanks Given: 0
Thanked 0 Times in 0 Posts
thank you very much. this is exactly what i need.
tjmannonline
View Public Profile for tjmannonline
Find all posts by tjmannonline
Login or Register to Ask a Question
Previous Thread
|
Next Thread
Login or Register to Ask a Question
Member Badges and Information Modal
×