reformat text in a file to another direction
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I have table in the current format:
Lead:Arrow1:Arrow2:Arrow3
Follow:Arrow4:Arrow5:Arrow6:Arrow7:Arrow8:Arrow9
I want to turn this to the
Lead:
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9
i tried awk
$(awk -F":" '/Lead/ print NF-1' $f)
$(awk -F":" '/Follow/ print NF-1' $f)
but didn't work how can I do it in awk
or any other method?
awk text-formatting
New contributor
kashef 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 |Â
up vote
2
down vote
favorite
I have table in the current format:
Lead:Arrow1:Arrow2:Arrow3
Follow:Arrow4:Arrow5:Arrow6:Arrow7:Arrow8:Arrow9
I want to turn this to the
Lead:
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9
i tried awk
$(awk -F":" '/Lead/ print NF-1' $f)
$(awk -F":" '/Follow/ print NF-1' $f)
but didn't work how can I do it in awk
or any other method?
awk text-formatting
New contributor
kashef is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Possible duplicate of Print each field of CSV on newline without knowing number of fields
– Î±Ò“sýιη
22 mins ago
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I have table in the current format:
Lead:Arrow1:Arrow2:Arrow3
Follow:Arrow4:Arrow5:Arrow6:Arrow7:Arrow8:Arrow9
I want to turn this to the
Lead:
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9
i tried awk
$(awk -F":" '/Lead/ print NF-1' $f)
$(awk -F":" '/Follow/ print NF-1' $f)
but didn't work how can I do it in awk
or any other method?
awk text-formatting
New contributor
kashef is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I have table in the current format:
Lead:Arrow1:Arrow2:Arrow3
Follow:Arrow4:Arrow5:Arrow6:Arrow7:Arrow8:Arrow9
I want to turn this to the
Lead:
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9
i tried awk
$(awk -F":" '/Lead/ print NF-1' $f)
$(awk -F":" '/Follow/ print NF-1' $f)
but didn't work how can I do it in awk
or any other method?
awk text-formatting
awk text-formatting
New contributor
kashef is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
kashef is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 28 mins ago


Jeff Schaller
33.7k851113
33.7k851113
New contributor
kashef is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 37 mins ago
kashef
132
132
New contributor
kashef is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
kashef is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
kashef is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Possible duplicate of Print each field of CSV on newline without knowing number of fields
– Î±Ò“sýιη
22 mins ago
add a comment |Â
Possible duplicate of Print each field of CSV on newline without knowing number of fields
– Î±Ò“sýιη
22 mins ago
Possible duplicate of Print each field of CSV on newline without knowing number of fields
– Î±Ò“sýιη
22 mins ago
Possible duplicate of Print each field of CSV on newline without knowing number of fields
– Î±Ò“sýιη
22 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
4
down vote
accepted
You can use tr
as follows:
<file tr ":" "n"
Lead
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9
or awk
as follows:
<file awk 'gsub(/:/,"n")1'
Lead
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
You can use tr
as follows:
<file tr ":" "n"
Lead
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9
or awk
as follows:
<file awk 'gsub(/:/,"n")1'
Lead
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9
add a comment |Â
up vote
4
down vote
accepted
You can use tr
as follows:
<file tr ":" "n"
Lead
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9
or awk
as follows:
<file awk 'gsub(/:/,"n")1'
Lead
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
You can use tr
as follows:
<file tr ":" "n"
Lead
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9
or awk
as follows:
<file awk 'gsub(/:/,"n")1'
Lead
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9
You can use tr
as follows:
<file tr ":" "n"
Lead
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9
or awk
as follows:
<file awk 'gsub(/:/,"n")1'
Lead
Arrow1
Arrow2
Arrow3
Follow
Arrow4
Arrow5
Arrow6
Arrow7
Arrow8
Arrow9
edited 23 mins ago
answered 35 mins ago
Goro
7,83453472
7,83453472
add a comment |Â
add a comment |Â
kashef is a new contributor. Be nice, and check out our Code of Conduct.
kashef is a new contributor. Be nice, and check out our Code of Conduct.
kashef is a new contributor. Be nice, and check out our Code of Conduct.
kashef 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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474240%2freformat-text-in-a-file-to-another-direction%23new-answer', 'question_page');
);
Post as a guest
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
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
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
Possible duplicate of Print each field of CSV on newline without knowing number of fields
– Î±Ò“sýιη
22 mins ago