1

I have two files with several columns and lines, let's say

file 1

x11 y11 z11 k11 ...........

x12 y12 z12 k12 ..........

x13 y13 z13 k13 ..........

.

.

.

file 2

x21 y21 z21 k21 ...........

x22 y22 z22 k22 ..........

x23 y23 z23 k23 ..........

.

.

.

I need to plot one column from file1, let's say z-column, and the k-column from file2. I cannot just merge the two file with the command "paste" because they are too big to be handled in this way.

1 Answer 1

1

Then you must first filter the two files before combining them with paste. One possibility is to use bash and process substitution to filter the files before pasting them together.

Only on the commandline you would open a bash terminal, and type e.g.

paste <(cut -d' ' -f 2 first.txt) <(cut -d' ' -f3 second.txt) > paste.txt

This would take the second column from file first.txt and the third column from file second.txt and paste them together into file paste.txt.

To do this on-the-fly inside gnuplot (see also https://stackoverflow.com/a/19290463/2604213 for an example), try

plot '< exec bash -c "paste <(cut -d'' '' -f 2 first.txt) <(cut -d'' '' -f3 second.txt)"' using 1:2

Of course you must changed the actual filtering calls to match your exact file structures, and pick the correct columns. Also, there are many other ways to do this, the important thing is to do the filtering before pasteing the files together.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.