0

I would like to join 5 CSV files. In all of them, the data starts at the 8th row. In two of them, I want to take out some lines at the end of the file.

From my precedent question "How to concatenate and sort three CSV files in Gnuplot" I know how to make it with 3 files and with one of which I select some rows with head command.

tail -q -n+8 file1 <(head -n 470 file2) file3

However, I have 5 files, and in 2 I want to select the number of data rows. How could I make this?. I want to execute this code inside a Gnuplot script.

NOTE: In the following link there are 5 CSV example files. In file5.csv I would like to not concatenate the last 10 lines and in file3.csv not concatenate the last 8 rows.

Regards

  • The verbs "paste" and "join" have specific meanings. "Pasting" (using the paste utility) adds files side by side (adding columns). "Joining" is a relational operation (used with the join utility or in relational databases) whereby you match the data in a particular column between two files. You seem to be talking about "concatenation", i.e. concatenating (adding) data to the end of other data. Is that correct? – Kusalananda Feb 12 at 12:39
  • @Kusalananda You are right. I want to join and match columns from different files. English is not my mother tongue:-) – user1993416 Feb 12 at 12:42
  • @Kusalananda Sorry I meant to say 'concatenation' not joining. – user1993416 Feb 12 at 12:53
  • Instead of specifying where the data starts show us an example of the data and we may be able to automate that part – user1133275 Feb 12 at 13:00
  • @Kusalananda Ok. I can post a link with 5 CSV – user1993416 Feb 12 at 13:23
1
tail -q -n+8 file1 file2 file3 <(head -n 470 file4) <(head -n 123 file5)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.