Register to reply

Subtracting numbers in two different txt files

by Arjani
Tags: files, numbers, subtracting
Share this thread:
Arjani
#1
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:

3
4
5

File 2:

1
2
1


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:

2
2
4

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 Phys.org
Apple to unveil 'iWatch' on September 9
NASA deep-space rocket, SLS, to launch in 2018
Study examines 13,000-year-old nanodiamonds from multiple locations across three continents
Borek
#2
Jan15-13, 02:17 AM
Admin
Borek's Avatar
P: 23,574
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
#3
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: http://easyprograming.com/index.php/...e-in-vb-script

MATLABdude
#4
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