Edit Tab Delimited Text File w/Data for Use w/Gnuplot

  • Thread starter Thread starter omegacore
  • Start date Start date
  • Tags Tags
    Data File
Click For Summary
To edit a tab space delimited text file on Ubuntu for use with gnuplot, a user needs to subtract values from one column in a file from another column in a different file, with around 1000 rows involved. Manual editing is impractical due to the volume of data. A quick solution involves using the awk programming language, which is suitable for simple text processing tasks. An example command to perform the subtraction is provided: awk '{print $1-$2}' datafile.txt, which illustrates how to print the result of subtracting the second column from the first. This method is efficient for the required operation and can be executed quickly to meet a tight deadline.
omegacore
Messages
14
Reaction score
0
Hello!

I am running ubuntu, I have a copy of open office excel, but I need to edit a tab space delimited text file with my data in it so I can use gnuplot to plot it.

The editing consists of subtracting one column of data from a file, from another column of data in another file. Each row corresponds to another row in another document... There are about 1000 rows so I cannot do this manually. My lab writeup is due in a few hours, this is the last step I need to complete for the analysis!

I know there is a way to write a quick and dirty program that will perform the operation, but my experience with such things is limited to date. So please! Help!
 
Computer science news on Phys.org
Look at awk (eg http://student.northpark.edu/pemente/awk/awk1line.txt ) it's a very simple language for text processing

Print column 1 - column 2 would be something like:
awk '{print $1-$2}' datafile.txt
 
Last edited by a moderator:
Thread 'ChatGPT Examples, Good and Bad'
I've been experimenting with ChatGPT. Some results are good, some very very bad. I think examples can help expose the properties of this AI. Maybe you can post some of your favorite examples and tell us what they reveal about the properties of this AI. (I had problems with copy/paste of text and formatting, so I'm posting my examples as screen shots. That is a promising start. :smile: But then I provided values V=1, R1=1, R2=2, R3=3 and asked for the value of I. At first, it said...

Similar threads

  • · Replies 13 ·
Replies
13
Views
2K
Replies
10
Views
2K
  • · Replies 19 ·
Replies
19
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 14 ·
Replies
14
Views
5K
Replies
4
Views
4K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K