adding a new line character to a row
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I'd like to extract the 2nd field and transpose it to become a row
cat > temp1
1 73
2 74
3 75
My approach :
cut -f2 temp1 | tr 'n' 't' > temp2
The result :
temp2
73 74 75
Understandably, there is a tab separator at the right end of the line but missing a new line character. Is there an simple one-liner to fix this?
shell awk sed grep tr
add a comment |Â
up vote
1
down vote
favorite
I'd like to extract the 2nd field and transpose it to become a row
cat > temp1
1 73
2 74
3 75
My approach :
cut -f2 temp1 | tr 'n' 't' > temp2
The result :
temp2
73 74 75
Understandably, there is a tab separator at the right end of the line but missing a new line character. Is there an simple one-liner to fix this?
shell awk sed grep tr
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'd like to extract the 2nd field and transpose it to become a row
cat > temp1
1 73
2 74
3 75
My approach :
cut -f2 temp1 | tr 'n' 't' > temp2
The result :
temp2
73 74 75
Understandably, there is a tab separator at the right end of the line but missing a new line character. Is there an simple one-liner to fix this?
shell awk sed grep tr
I'd like to extract the 2nd field and transpose it to become a row
cat > temp1
1 73
2 74
3 75
My approach :
cut -f2 temp1 | tr 'n' 't' > temp2
The result :
temp2
73 74 75
Understandably, there is a tab separator at the right end of the line but missing a new line character. Is there an simple one-liner to fix this?
shell awk sed grep tr
shell awk sed grep tr
asked 25 mins ago
Aron
63
63
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
Use paste
instead of tr
:
$ cut -f2 temp1 | paste -s
73 74 75
verifying the invisible whitespace
$ cut -f2 temp1 | paste -s | od -c
0000000 7 3 t 7 4 t 7 5 n
0000011
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Use paste
instead of tr
:
$ cut -f2 temp1 | paste -s
73 74 75
verifying the invisible whitespace
$ cut -f2 temp1 | paste -s | od -c
0000000 7 3 t 7 4 t 7 5 n
0000011
add a comment |Â
up vote
0
down vote
Use paste
instead of tr
:
$ cut -f2 temp1 | paste -s
73 74 75
verifying the invisible whitespace
$ cut -f2 temp1 | paste -s | od -c
0000000 7 3 t 7 4 t 7 5 n
0000011
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Use paste
instead of tr
:
$ cut -f2 temp1 | paste -s
73 74 75
verifying the invisible whitespace
$ cut -f2 temp1 | paste -s | od -c
0000000 7 3 t 7 4 t 7 5 n
0000011
Use paste
instead of tr
:
$ cut -f2 temp1 | paste -s
73 74 75
verifying the invisible whitespace
$ cut -f2 temp1 | paste -s | od -c
0000000 7 3 t 7 4 t 7 5 n
0000011
answered 2 mins ago
glenn jackman
48.6k366105
48.6k366105
add a comment |Â
add a comment |Â
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%2f474646%2fadding-a-new-line-character-to-a-row%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