LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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
 
LinkBack 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; Gentoo PPC; Gentoo Sparc64; FreeBSD; OS X; Solaris
Posts: 3,731
Blog Entries: 4

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


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are 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


All times are GMT -5. The time now is 08:18 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration