How to concatenate several CSV files avoiding some lines at the beginning and in some at the end
Clash Royale CLAN TAG#URR8PPP
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
shell csv
add a comment |
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
shell csv
The verbs "paste" and "join" have specific meanings. "Pasting" (using thepaste
utility) adds files side by side (adding columns). "Joining" is a relational operation (used with thejoin
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
add a comment |
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
shell csv
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
shell csv
shell csv
edited Feb 12 at 13:29
user1993416
asked Feb 12 at 12:33
user1993416user1993416
1175
1175
The verbs "paste" and "join" have specific meanings. "Pasting" (using thepaste
utility) adds files side by side (adding columns). "Joining" is a relational operation (used with thejoin
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
add a comment |
The verbs "paste" and "join" have specific meanings. "Pasting" (using thepaste
utility) adds files side by side (adding columns). "Joining" is a relational operation (used with thejoin
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
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
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 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
@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
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
@Kusalananda Ok. I can post a link with 5 CSV
– user1993416
Feb 12 at 13:23
add a comment |
1 Answer
1
active
oldest
votes
tail -q -n+8 file1 file2 file3 <(head -n 470 file4) <(head -n 123 file5)
Thank you. It works fine.
– user1993416
Feb 12 at 13:35
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f500164%2fhow-to-concatenate-several-csv-files-avoiding-some-lines-at-the-beginning-and-in%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
tail -q -n+8 file1 file2 file3 <(head -n 470 file4) <(head -n 123 file5)
Thank you. It works fine.
– user1993416
Feb 12 at 13:35
add a comment |
tail -q -n+8 file1 file2 file3 <(head -n 470 file4) <(head -n 123 file5)
Thank you. It works fine.
– user1993416
Feb 12 at 13:35
add a comment |
tail -q -n+8 file1 file2 file3 <(head -n 470 file4) <(head -n 123 file5)
tail -q -n+8 file1 file2 file3 <(head -n 470 file4) <(head -n 123 file5)
answered Feb 12 at 13:04
user1133275user1133275
3,570823
3,570823
Thank you. It works fine.
– user1993416
Feb 12 at 13:35
add a comment |
Thank you. It works fine.
– user1993416
Feb 12 at 13:35
Thank you. It works fine.
– user1993416
Feb 12 at 13:35
Thank you. It works fine.
– user1993416
Feb 12 at 13:35
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f500164%2fhow-to-concatenate-several-csv-files-avoiding-some-lines-at-the-beginning-and-in%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
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 thejoin
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