Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 01-20-2006, 02:53 PM   #1
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

cat file2

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
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
VALUE=$((`cat file1` + `cat file2`))


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:39 PM.

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