Subtracting numbers in two different txt files

by Arjani
Tags: files, numbers, subtracting
Arjani is offline
Jan14-13, 09:21 PM
P: 21
I have two .txt files with a bunch of numbers in them, below each other, like this:

File 1:


File 2:


Now I want to subtract the numbers in file 2 from the numbers in file 1 and get the results in a new .txt file:

File 3:


Very simple. I was going to do it in Excel, but I don't have that right now. Does anyone know another easy way?
Phys.Org News Partner Science news on
NASA's space station Robonaut finally getting legs
Free the seed: OSSI nurtures growing plants without patent barriers
Going nuts? Turkey looks to pistachios to heat new eco-city
Borek is online now
Jan15-13, 02:17 AM
Borek's Avatar
P: 22,679
Use OpenOffice then. Or write Python script. Or post your problem giving enough information about OS and tools available to get a meaningful answer.
NemoReally is offline
Jan15-13, 05:02 AM
P: 194
If you've got Windows, try VBScript. Read the 2 files into an array, add the elements of the arrays and write the results back out. Here's a link showing how to read and write files:

MATLABdude is offline
Jan20-13, 08:42 PM
Sci Advisor
P: 1,724

Subtracting numbers in two different txt files

You could download Open or Libre Office, or sign up for a GMail account and use the spreadsheet Google Docs application.

Register to reply

Related Discussions
Subtracting negative numbers General Math 14
Subtracting two vectors Introductory Physics Homework 14
Subtracting 3 Vectors Introductory Physics Homework 1
Subtracting Vectors? Introductory Physics Homework 12
Subtracting voltages General Physics 11