how to pipe two to shell scripts?2019 Community Moderator Electionhow to take an output of a script as an input to another one?Compare two files with first column and remove duplicate row from 2nd file in shell scriptfind out the size of open terminalMerge two-columns files into one fileHow do I get ~/.bashrc to execute all scripts in my ~/Shell directory using a loop?How to generate a set of new different files through shell scripting given a certain pattern name?sort by the maximum of the first two columnsHow to print unique name in UNIX using commandWhy the Terminal and the Shell are two separate programs in Linux?How does the Terminal and the Shell exchange data?How do I compare one text file against about two dozen other text files and print out certain columns of each line whenever there is a match?
Did Swami Prabhupada reject Advaita?
Is it improper etiquette to ask your opponent what his/her rating is before the game?
Count the occurrence of each unique word in the file
Should I outline or discovery write my stories?
Is the U.S. Code copyrighted by the Government?
What should you do if you miss a job interview (deliberately)?
Is it safe to use olive oil to clean the ear wax?
Why did the EU agree to delay the Brexit deadline?
Multiplicative persistence
What does chmod -u do?
How can "mimic phobia" be cured or prevented?
dpdt switch to spst switch
Which one is correct as adjective “protruding” or “protruded”?
What is Cash Advance APR?
The screen of my macbook suddenly broken down how can I do to recover
Is this toilet slogan correct usage of the English language?
Removing files under particular conditions (number of files, file age)
Delivering sarcasm
Longest common substring in linear time
Electoral considerations aside, what are potential benefits, for the US, of policy changes proposed by the tweet recognizing Golan annexation?
Problem with TransformedDistribution
How to explain what's wrong with this application of the chain rule?
Has any country ever had 2 former presidents in jail simultaneously?
If a character has darkvision, can they see through an area of nonmagical darkness filled with lightly obscuring gas?
how to pipe two to shell scripts?
2019 Community Moderator Electionhow to take an output of a script as an input to another one?Compare two files with first column and remove duplicate row from 2nd file in shell scriptfind out the size of open terminalMerge two-columns files into one fileHow do I get ~/.bashrc to execute all scripts in my ~/Shell directory using a loop?How to generate a set of new different files through shell scripting given a certain pattern name?sort by the maximum of the first two columnsHow to print unique name in UNIX using commandWhy the Terminal and the Shell are two separate programs in Linux?How does the Terminal and the Shell exchange data?How do I compare one text file against about two dozen other text files and print out certain columns of each line whenever there is a match?
how to cut the selected columns from the file.
Example:
load.sh students.csv | select.sh ‘name’ ‘school_name’
This will output the name and school_name columna from the loaded file to the terminal.
shell-script terminal
New contributor
user343113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
how to cut the selected columns from the file.
Example:
load.sh students.csv | select.sh ‘name’ ‘school_name’
This will output the name and school_name columna from the loaded file to the terminal.
shell-script terminal
New contributor
user343113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Please provide sample input and expected output
– Jesse_b
yesterday
@Jesse_b, Agreed. Please provide example which will be more easy. Is it not possible to do so in same script ?
– Vivek Kanadiya
yesterday
You're thinking too much like Windows Powershell. UNIX/Linux shells don't pass objects through pipes.
– roaima
11 hours ago
add a comment |
how to cut the selected columns from the file.
Example:
load.sh students.csv | select.sh ‘name’ ‘school_name’
This will output the name and school_name columna from the loaded file to the terminal.
shell-script terminal
New contributor
user343113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
how to cut the selected columns from the file.
Example:
load.sh students.csv | select.sh ‘name’ ‘school_name’
This will output the name and school_name columna from the loaded file to the terminal.
shell-script terminal
shell-script terminal
New contributor
user343113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
user343113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited yesterday
Archemar
20.3k93973
20.3k93973
New contributor
user343113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked yesterday
user343113user343113
11
11
New contributor
user343113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
user343113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
user343113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Please provide sample input and expected output
– Jesse_b
yesterday
@Jesse_b, Agreed. Please provide example which will be more easy. Is it not possible to do so in same script ?
– Vivek Kanadiya
yesterday
You're thinking too much like Windows Powershell. UNIX/Linux shells don't pass objects through pipes.
– roaima
11 hours ago
add a comment |
1
Please provide sample input and expected output
– Jesse_b
yesterday
@Jesse_b, Agreed. Please provide example which will be more easy. Is it not possible to do so in same script ?
– Vivek Kanadiya
yesterday
You're thinking too much like Windows Powershell. UNIX/Linux shells don't pass objects through pipes.
– roaima
11 hours ago
1
1
Please provide sample input and expected output
– Jesse_b
yesterday
Please provide sample input and expected output
– Jesse_b
yesterday
@Jesse_b, Agreed. Please provide example which will be more easy. Is it not possible to do so in same script ?
– Vivek Kanadiya
yesterday
@Jesse_b, Agreed. Please provide example which will be more easy. Is it not possible to do so in same script ?
– Vivek Kanadiya
yesterday
You're thinking too much like Windows Powershell. UNIX/Linux shells don't pass objects through pipes.
– roaima
11 hours ago
You're thinking too much like Windows Powershell. UNIX/Linux shells don't pass objects through pipes.
– roaima
11 hours ago
add a comment |
1 Answer
1
active
oldest
votes
Use csvcut or csvsql from csvkit:
csvcut -c name,school_name students.csv
csvsql --query 'select name, school_name from students' students.csv
Example:
$ cat students.csv
id,name,surname,school_name,favorite_color
1,Tom,Sawyer,Harvard,red
2,Bob,"the Builder",Oxford,orange
3,John,Sinclair,"Columbine High",blue
4,Walter,Mitty,"Thomas Jefferson High",green
5,Donald,Trump,Unknown,blue
$ csvcut -c name,school_name students.csv
name,school_name
Tom,Harvard
Bob,Oxford
John,Columbine High
Walter,Thomas Jefferson High
Donald,Unknown
cvscutwould be easier, if the columns have named headers.
– Kusalananda
yesterday
True... I'll add that.csvsql is good if we need some grouping/joins etc, but for such simple select you're right.
– RoVo
yesterday
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
);
);
user343113 is a new contributor. Be nice, and check out our Code of Conduct.
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%2f507986%2fhow-to-pipe-two-to-shell-scripts%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
Use csvcut or csvsql from csvkit:
csvcut -c name,school_name students.csv
csvsql --query 'select name, school_name from students' students.csv
Example:
$ cat students.csv
id,name,surname,school_name,favorite_color
1,Tom,Sawyer,Harvard,red
2,Bob,"the Builder",Oxford,orange
3,John,Sinclair,"Columbine High",blue
4,Walter,Mitty,"Thomas Jefferson High",green
5,Donald,Trump,Unknown,blue
$ csvcut -c name,school_name students.csv
name,school_name
Tom,Harvard
Bob,Oxford
John,Columbine High
Walter,Thomas Jefferson High
Donald,Unknown
cvscutwould be easier, if the columns have named headers.
– Kusalananda
yesterday
True... I'll add that.csvsql is good if we need some grouping/joins etc, but for such simple select you're right.
– RoVo
yesterday
add a comment |
Use csvcut or csvsql from csvkit:
csvcut -c name,school_name students.csv
csvsql --query 'select name, school_name from students' students.csv
Example:
$ cat students.csv
id,name,surname,school_name,favorite_color
1,Tom,Sawyer,Harvard,red
2,Bob,"the Builder",Oxford,orange
3,John,Sinclair,"Columbine High",blue
4,Walter,Mitty,"Thomas Jefferson High",green
5,Donald,Trump,Unknown,blue
$ csvcut -c name,school_name students.csv
name,school_name
Tom,Harvard
Bob,Oxford
John,Columbine High
Walter,Thomas Jefferson High
Donald,Unknown
cvscutwould be easier, if the columns have named headers.
– Kusalananda
yesterday
True... I'll add that.csvsql is good if we need some grouping/joins etc, but for such simple select you're right.
– RoVo
yesterday
add a comment |
Use csvcut or csvsql from csvkit:
csvcut -c name,school_name students.csv
csvsql --query 'select name, school_name from students' students.csv
Example:
$ cat students.csv
id,name,surname,school_name,favorite_color
1,Tom,Sawyer,Harvard,red
2,Bob,"the Builder",Oxford,orange
3,John,Sinclair,"Columbine High",blue
4,Walter,Mitty,"Thomas Jefferson High",green
5,Donald,Trump,Unknown,blue
$ csvcut -c name,school_name students.csv
name,school_name
Tom,Harvard
Bob,Oxford
John,Columbine High
Walter,Thomas Jefferson High
Donald,Unknown
Use csvcut or csvsql from csvkit:
csvcut -c name,school_name students.csv
csvsql --query 'select name, school_name from students' students.csv
Example:
$ cat students.csv
id,name,surname,school_name,favorite_color
1,Tom,Sawyer,Harvard,red
2,Bob,"the Builder",Oxford,orange
3,John,Sinclair,"Columbine High",blue
4,Walter,Mitty,"Thomas Jefferson High",green
5,Donald,Trump,Unknown,blue
$ csvcut -c name,school_name students.csv
name,school_name
Tom,Harvard
Bob,Oxford
John,Columbine High
Walter,Thomas Jefferson High
Donald,Unknown
edited yesterday
answered yesterday
RoVoRoVo
3,367317
3,367317
cvscutwould be easier, if the columns have named headers.
– Kusalananda
yesterday
True... I'll add that.csvsql is good if we need some grouping/joins etc, but for such simple select you're right.
– RoVo
yesterday
add a comment |
cvscutwould be easier, if the columns have named headers.
– Kusalananda
yesterday
True... I'll add that.csvsql is good if we need some grouping/joins etc, but for such simple select you're right.
– RoVo
yesterday
cvscut would be easier, if the columns have named headers.– Kusalananda
yesterday
cvscut would be easier, if the columns have named headers.– Kusalananda
yesterday
True... I'll add that.csvsql is good if we need some grouping/joins etc, but for such simple select you're right.
– RoVo
yesterday
True... I'll add that.csvsql is good if we need some grouping/joins etc, but for such simple select you're right.
– RoVo
yesterday
add a comment |
user343113 is a new contributor. Be nice, and check out our Code of Conduct.
user343113 is a new contributor. Be nice, and check out our Code of Conduct.
user343113 is a new contributor. Be nice, and check out our Code of Conduct.
user343113 is a new contributor. Be nice, and check out our Code of Conduct.
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%2f507986%2fhow-to-pipe-two-to-shell-scripts%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
1
Please provide sample input and expected output
– Jesse_b
yesterday
@Jesse_b, Agreed. Please provide example which will be more easy. Is it not possible to do so in same script ?
– Vivek Kanadiya
yesterday
You're thinking too much like Windows Powershell. UNIX/Linux shells don't pass objects through pipes.
– roaima
11 hours ago