how to rename output of split command to match the first word in each line? The 2019 Stack...
Would an alien lifeform be able to achieve space travel if lacking in vision?
Mortgage adviser recommends a longer term than necessary combined with overpayments
How to determine omitted units in a publication
Drawing vertical/oblique lines in Metrical tree (tikz-qtree, tipa)
What happens to a Warlock's expended Spell Slots when they gain a Level?
Loose spokes after only a few rides
Sub-subscripts in strings cause different spacings than subscripts
Why are PDP-7-style microprogrammed instructions out of vogue?
The following signatures were invalid: EXPKEYSIG 1397BC53640DB551
What do I do when my TA workload is more than expected?
Is there a way to generate uniformly distributed points on a sphere from a fixed amount of random real numbers per point?
How to read αἱμύλιος or when to aspirate
Is this wall load bearing? Blueprints and photos attached
Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?
Can each chord in a progression create its own key?
Homework question about an engine pulling a train
ELI5: Why do they say that Israel would have been the fourth country to land a spacecraft on the Moon and why do they call it low cost?
How do you keep chess fun when your opponent constantly beats you?
Can the DM override racial traits?
What information about me do stores get via my credit card?
"... to apply for a visa" or "... and applied for a visa"?
Word for: a synonym with a positive connotation?
Student Loan from years ago pops up and is taking my salary
60's-70's movie: home appliances revolting against the owners
how to rename output of split command to match the first word in each line?
The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election ResultsExtract data from a file and place in different files based on1 column valueHow to split a file by counting digit numbers within a row?Split string into array and print each element on a new line with commandlineHow to insert a line from file A above the FIRST LINE in file BSplitting a single file into multiple files based on matching strings in LinuxCompare two files and print only the first word of the lines which don't match along with a stringSplit single line into multiple lines, Newline character missing for all the lines in input filesplit file based on the first digit in the lineHow to print all the lines that's first word is the first word of a file?How to read a file line by line then take each line and insert into txt fileIterate print for each line in output
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I have input.txt file (with 4 lines)like this:
GGTAACC_MIR4095P USP7 MKRN1 TSHZ3 EIF2C1 SRSF8 CAMK2G ARID4B
GCM_TINF2 MORF4L1 ABHD16A ZNF274 C7orf43 SNX33
chr9q34 MRPL41 OR5C1 LOC138159 GBGT1
REACTOME_SIGNALING_BY_NOTCH1 HDAC6 HDAC5 MAMLD1
How to split this file into 4 files (my original file has 39 lines) so that I get 4 files each named by the first word in a line:
GGTAACC_MIR4095P.txt
GCM_TINF2.txt
chr9q34.txt
REACTOME_SIGNALING_BY_NOTCH1.txt
What I tried so far is this:
split -d -a 2 -l 1 input.txt output_
This is very far from the solution I need.
The solution per advice of @steeldriver is :
awk -F " " '{print >$1".txt"}' input.txt
text-processing command-line split
add a comment |
I have input.txt file (with 4 lines)like this:
GGTAACC_MIR4095P USP7 MKRN1 TSHZ3 EIF2C1 SRSF8 CAMK2G ARID4B
GCM_TINF2 MORF4L1 ABHD16A ZNF274 C7orf43 SNX33
chr9q34 MRPL41 OR5C1 LOC138159 GBGT1
REACTOME_SIGNALING_BY_NOTCH1 HDAC6 HDAC5 MAMLD1
How to split this file into 4 files (my original file has 39 lines) so that I get 4 files each named by the first word in a line:
GGTAACC_MIR4095P.txt
GCM_TINF2.txt
chr9q34.txt
REACTOME_SIGNALING_BY_NOTCH1.txt
What I tried so far is this:
split -d -a 2 -l 1 input.txt output_
This is very far from the solution I need.
The solution per advice of @steeldriver is :
awk -F " " '{print >$1".txt"}' input.txt
text-processing command-line split
Related: Extract data from a file and place in different files based on1 column value
– steeldriver
6 hours ago
Thank you so much!!! That indeed solved my problem, I will post the solution above.
– anikaM
6 hours ago
add a comment |
I have input.txt file (with 4 lines)like this:
GGTAACC_MIR4095P USP7 MKRN1 TSHZ3 EIF2C1 SRSF8 CAMK2G ARID4B
GCM_TINF2 MORF4L1 ABHD16A ZNF274 C7orf43 SNX33
chr9q34 MRPL41 OR5C1 LOC138159 GBGT1
REACTOME_SIGNALING_BY_NOTCH1 HDAC6 HDAC5 MAMLD1
How to split this file into 4 files (my original file has 39 lines) so that I get 4 files each named by the first word in a line:
GGTAACC_MIR4095P.txt
GCM_TINF2.txt
chr9q34.txt
REACTOME_SIGNALING_BY_NOTCH1.txt
What I tried so far is this:
split -d -a 2 -l 1 input.txt output_
This is very far from the solution I need.
The solution per advice of @steeldriver is :
awk -F " " '{print >$1".txt"}' input.txt
text-processing command-line split
I have input.txt file (with 4 lines)like this:
GGTAACC_MIR4095P USP7 MKRN1 TSHZ3 EIF2C1 SRSF8 CAMK2G ARID4B
GCM_TINF2 MORF4L1 ABHD16A ZNF274 C7orf43 SNX33
chr9q34 MRPL41 OR5C1 LOC138159 GBGT1
REACTOME_SIGNALING_BY_NOTCH1 HDAC6 HDAC5 MAMLD1
How to split this file into 4 files (my original file has 39 lines) so that I get 4 files each named by the first word in a line:
GGTAACC_MIR4095P.txt
GCM_TINF2.txt
chr9q34.txt
REACTOME_SIGNALING_BY_NOTCH1.txt
What I tried so far is this:
split -d -a 2 -l 1 input.txt output_
This is very far from the solution I need.
The solution per advice of @steeldriver is :
awk -F " " '{print >$1".txt"}' input.txt
text-processing command-line split
text-processing command-line split
edited 6 hours ago
anikaM
asked 7 hours ago
anikaManikaM
13
13
Related: Extract data from a file and place in different files based on1 column value
– steeldriver
6 hours ago
Thank you so much!!! That indeed solved my problem, I will post the solution above.
– anikaM
6 hours ago
add a comment |
Related: Extract data from a file and place in different files based on1 column value
– steeldriver
6 hours ago
Thank you so much!!! That indeed solved my problem, I will post the solution above.
– anikaM
6 hours ago
Related: Extract data from a file and place in different files based on1 column value
– steeldriver
6 hours ago
Related: Extract data from a file and place in different files based on1 column value
– steeldriver
6 hours ago
Thank you so much!!! That indeed solved my problem, I will post the solution above.
– anikaM
6 hours ago
Thank you so much!!! That indeed solved my problem, I will post the solution above.
– anikaM
6 hours ago
add a comment |
1 Answer
1
active
oldest
votes
with Miller (https://github.com/johnkerl/miller) using
mlr --nidx --ifs ' ' --repifs unsparsify then put -q 'tee > $1.".txt", $*' input.txt
you will have this four files:
chr9q34.txt
GCM_TINF2.txt
GGTAACC_MIR4095P.txt
REACTOME_SIGNALING_BY_NOTCH1.txt
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%2f512169%2fhow-to-rename-output-of-split-command-to-match-the-first-word-in-each-line%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
with Miller (https://github.com/johnkerl/miller) using
mlr --nidx --ifs ' ' --repifs unsparsify then put -q 'tee > $1.".txt", $*' input.txt
you will have this four files:
chr9q34.txt
GCM_TINF2.txt
GGTAACC_MIR4095P.txt
REACTOME_SIGNALING_BY_NOTCH1.txt
add a comment |
with Miller (https://github.com/johnkerl/miller) using
mlr --nidx --ifs ' ' --repifs unsparsify then put -q 'tee > $1.".txt", $*' input.txt
you will have this four files:
chr9q34.txt
GCM_TINF2.txt
GGTAACC_MIR4095P.txt
REACTOME_SIGNALING_BY_NOTCH1.txt
add a comment |
with Miller (https://github.com/johnkerl/miller) using
mlr --nidx --ifs ' ' --repifs unsparsify then put -q 'tee > $1.".txt", $*' input.txt
you will have this four files:
chr9q34.txt
GCM_TINF2.txt
GGTAACC_MIR4095P.txt
REACTOME_SIGNALING_BY_NOTCH1.txt
with Miller (https://github.com/johnkerl/miller) using
mlr --nidx --ifs ' ' --repifs unsparsify then put -q 'tee > $1.".txt", $*' input.txt
you will have this four files:
chr9q34.txt
GCM_TINF2.txt
GGTAACC_MIR4095P.txt
REACTOME_SIGNALING_BY_NOTCH1.txt
answered 6 hours ago
aborrusoaborruso
373311
373311
add a comment |
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%2f512169%2fhow-to-rename-output-of-split-command-to-match-the-first-word-in-each-line%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
Related: Extract data from a file and place in different files based on1 column value
– steeldriver
6 hours ago
Thank you so much!!! That indeed solved my problem, I will post the solution above.
– anikaM
6 hours ago