join scrambles output
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
For some reason my output of join is strange and scrambled; here is the command I use:
join -t, -j 1 -o1.1,2.2,1.2 f1 f2
Where f1:
1,87
and f2:
1,337
The output is:
,8737
and I am at loss as to why the output of join is not as expected. I have checked my locale already, with no luck.
Any ideas?
join
add a comment |Â
up vote
0
down vote
favorite
For some reason my output of join is strange and scrambled; here is the command I use:
join -t, -j 1 -o1.1,2.2,1.2 f1 f2
Where f1:
1,87
and f2:
1,337
The output is:
,8737
and I am at loss as to why the output of join is not as expected. I have checked my locale already, with no luck.
Any ideas?
join
2
Does the file have DOS line endings (CR LF)? Add the output ofjoin -t, -j 1 -o1.1,2.2,1.2 f1 f2 | od -c
please.
â muru
Jul 5 at 6:15
Thanks, I did not know theod
command ! Your intuition was right, it is DOS endings
â Tiphaine
Jul 5 at 6:24
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
For some reason my output of join is strange and scrambled; here is the command I use:
join -t, -j 1 -o1.1,2.2,1.2 f1 f2
Where f1:
1,87
and f2:
1,337
The output is:
,8737
and I am at loss as to why the output of join is not as expected. I have checked my locale already, with no luck.
Any ideas?
join
For some reason my output of join is strange and scrambled; here is the command I use:
join -t, -j 1 -o1.1,2.2,1.2 f1 f2
Where f1:
1,87
and f2:
1,337
The output is:
,8737
and I am at loss as to why the output of join is not as expected. I have checked my locale already, with no luck.
Any ideas?
join
edited Jul 5 at 6:14
muru
33.1k576139
33.1k576139
asked Jul 5 at 6:12
Tiphaine
31
31
2
Does the file have DOS line endings (CR LF)? Add the output ofjoin -t, -j 1 -o1.1,2.2,1.2 f1 f2 | od -c
please.
â muru
Jul 5 at 6:15
Thanks, I did not know theod
command ! Your intuition was right, it is DOS endings
â Tiphaine
Jul 5 at 6:24
add a comment |Â
2
Does the file have DOS line endings (CR LF)? Add the output ofjoin -t, -j 1 -o1.1,2.2,1.2 f1 f2 | od -c
please.
â muru
Jul 5 at 6:15
Thanks, I did not know theod
command ! Your intuition was right, it is DOS endings
â Tiphaine
Jul 5 at 6:24
2
2
Does the file have DOS line endings (CR LF)? Add the output of
join -t, -j 1 -o1.1,2.2,1.2 f1 f2 | od -c
please.â muru
Jul 5 at 6:15
Does the file have DOS line endings (CR LF)? Add the output of
join -t, -j 1 -o1.1,2.2,1.2 f1 f2 | od -c
please.â muru
Jul 5 at 6:15
Thanks, I did not know the
od
command ! Your intuition was right, it is DOS endingsâ Tiphaine
Jul 5 at 6:24
Thanks, I did not know the
od
command ! Your intuition was right, it is DOS endingsâ Tiphaine
Jul 5 at 6:24
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
Your data file are DOS text files. Each line has a trailing carriage return character.
The output that you expect is
1,337,87
but since there is a carriage return after the 7
in 337
(from the DOS line-ending in the second file), the cursor moves back to the start of the line before printing ,87
, overwriting 1,33
there.
Run dos2unix
on the data files to convert them to Unix text files, or instruct whatever program that creates them to create Unix text files.
Thanks, indeed this is it. I suspected it at first but threw that idea of since the files were made by a colleague on MacOS, it it seems the python csv module output DOS files by default
â Tiphaine
Jul 5 at 6:25
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Your data file are DOS text files. Each line has a trailing carriage return character.
The output that you expect is
1,337,87
but since there is a carriage return after the 7
in 337
(from the DOS line-ending in the second file), the cursor moves back to the start of the line before printing ,87
, overwriting 1,33
there.
Run dos2unix
on the data files to convert them to Unix text files, or instruct whatever program that creates them to create Unix text files.
Thanks, indeed this is it. I suspected it at first but threw that idea of since the files were made by a colleague on MacOS, it it seems the python csv module output DOS files by default
â Tiphaine
Jul 5 at 6:25
add a comment |Â
up vote
2
down vote
accepted
Your data file are DOS text files. Each line has a trailing carriage return character.
The output that you expect is
1,337,87
but since there is a carriage return after the 7
in 337
(from the DOS line-ending in the second file), the cursor moves back to the start of the line before printing ,87
, overwriting 1,33
there.
Run dos2unix
on the data files to convert them to Unix text files, or instruct whatever program that creates them to create Unix text files.
Thanks, indeed this is it. I suspected it at first but threw that idea of since the files were made by a colleague on MacOS, it it seems the python csv module output DOS files by default
â Tiphaine
Jul 5 at 6:25
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Your data file are DOS text files. Each line has a trailing carriage return character.
The output that you expect is
1,337,87
but since there is a carriage return after the 7
in 337
(from the DOS line-ending in the second file), the cursor moves back to the start of the line before printing ,87
, overwriting 1,33
there.
Run dos2unix
on the data files to convert them to Unix text files, or instruct whatever program that creates them to create Unix text files.
Your data file are DOS text files. Each line has a trailing carriage return character.
The output that you expect is
1,337,87
but since there is a carriage return after the 7
in 337
(from the DOS line-ending in the second file), the cursor moves back to the start of the line before printing ,87
, overwriting 1,33
there.
Run dos2unix
on the data files to convert them to Unix text files, or instruct whatever program that creates them to create Unix text files.
answered Jul 5 at 6:17
Kusalananda
101k13199312
101k13199312
Thanks, indeed this is it. I suspected it at first but threw that idea of since the files were made by a colleague on MacOS, it it seems the python csv module output DOS files by default
â Tiphaine
Jul 5 at 6:25
add a comment |Â
Thanks, indeed this is it. I suspected it at first but threw that idea of since the files were made by a colleague on MacOS, it it seems the python csv module output DOS files by default
â Tiphaine
Jul 5 at 6:25
Thanks, indeed this is it. I suspected it at first but threw that idea of since the files were made by a colleague on MacOS, it it seems the python csv module output DOS files by default
â Tiphaine
Jul 5 at 6:25
Thanks, indeed this is it. I suspected it at first but threw that idea of since the files were made by a colleague on MacOS, it it seems the python csv module output DOS files by default
â Tiphaine
Jul 5 at 6:25
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%2f453535%2fjoin-scrambles-output%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
2
Does the file have DOS line endings (CR LF)? Add the output of
join -t, -j 1 -o1.1,2.2,1.2 f1 f2 | od -c
please.â muru
Jul 5 at 6:15
Thanks, I did not know the
od
command ! Your intuition was right, it is DOS endingsâ Tiphaine
Jul 5 at 6:24