LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-20-2006, 02:53 PM   #1
lluciano
LQ Newbie
 
Registered: Feb 2004
Distribution: FC4
Posts: 19

Rep: Reputation: 0
Adding values of 2 files


Simple question (I think, as I cannot find the answer anywgere).

I have 2 files, with only 1 line each, and need to add the values of both and echo to console:

cat file1
10100

cat file2
20000

I need the total, 30100 to be seen at the end of my script (on both Linux and HP machines)
 
Old 01-20-2006, 02:57 PM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Code:
VALUE=$((`cat file1` + `cat file2`))
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding more groups to files djchris Linux - Security 1 07-27-2005 10:36 AM
adding my own commands to rc files SizofreNICK Slackware 8 11-07-2004 02:30 AM
Setting ulimit values in files on Redhat AS 2.1 Darrell22 Linux - Newbie 0 06-29-2004 07:53 PM
(Bash) Saving READ values in external .conf files spikylee Linux - Newbie 4 10-28-2003 06:46 AM
What are the right values for zone files. jolly Linux - General 0 05-06-2003 12:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration