Pasting Files with hidden spaces

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












I am having a little trouble with pasting files. I have three files



temp1



F gge0006x
D 12-30-2006
T 14:05:23
S a69
B 15.4
M gge06001
P 30.8
Q 19.2
R 1006.2
U 1012.7
X 36.2
A 38.994
G 107.71
H 8.411
O 37.084
C 7.537
K 28.198
W 212.52
L 68.1


temp2



gge0006y
12-30-2006
14:05:55
a69
15.3
gge06001
30.6
21.1
1006.6
1014.6
36.1
38.994
107.71
8.433
36.705
7.621
27.623
210.51
68


and temp3



gge0006z
12-30-2006
14:06:28
a69
15.7
gge06001
30.3
23.5
1008
1014.1
36.6
38.994
107.71
8.434
36.508
7.546
27.574
208.08
67.6


I am looking to have a single file that looks something like



F gge0001x gge0001y gge0001z
D 12-30-2006 12-30-2006 12-30-2006
T 14:15:20 14:15:55 14:16:27
S a69 a69 a69
B 15.8 16.1 15
M gge06001 gge06001 gge06001
P 30.1 29.6 29.9
Q 20.2 22.3 23.4
R 1006.2 1003.5 999.8
U 1011.8 1011.8 1005
X 34.7 35.2 35.1
A 38.994 38.994 38.994
G 107.71 107.71 107.71
H 8.395 8.406 8.368
O 37.141 36.823 36.621
C 7.55 7.532 7.437
K 28.193 27.902 27.856
W 212.86 210.15 207.15
L 68.3 67.9 67.6


Yet when I go to paste using paste -d" " temp1 temp2 temp3
I get:



 gge0006zx
12-30-20066
14:06:283
a699
15.74
gge060011
P 30.8 30.6 30.3
Q 19.2 21.1 23.5
R 1006.2 1006.6 1008
U 1012.7 1014.6 1014.1
36.62
A 38.994 38.994 38.994
G 107.71 107.71 107.71
H 8.411 8.433 8.434
O 37.084 36.705 36.508
C 7.537 7.621 7.546
K 28.198 27.623 27.574
W 212.52 210.51 208.08
L 68.1 68 67.6


Which leads me to think that there are some unseen spaces spaces in my files or something like that as I had to sort and copy these three files from other files. I am also missing data, so I am not sure what is going on there either...
If it is the case that there are spaces that I cannot see, is there a way to clear these so that I can get a desirable result?



Any help would be great. Thank you










share|improve this question





















  • If you suspect hidden characters, it's usually a good idea to make them visible. One way is to use sed -n l filename
    – Philippos
    Oct 11 '17 at 7:32














up vote
3
down vote

favorite












I am having a little trouble with pasting files. I have three files



temp1



F gge0006x
D 12-30-2006
T 14:05:23
S a69
B 15.4
M gge06001
P 30.8
Q 19.2
R 1006.2
U 1012.7
X 36.2
A 38.994
G 107.71
H 8.411
O 37.084
C 7.537
K 28.198
W 212.52
L 68.1


temp2



gge0006y
12-30-2006
14:05:55
a69
15.3
gge06001
30.6
21.1
1006.6
1014.6
36.1
38.994
107.71
8.433
36.705
7.621
27.623
210.51
68


and temp3



gge0006z
12-30-2006
14:06:28
a69
15.7
gge06001
30.3
23.5
1008
1014.1
36.6
38.994
107.71
8.434
36.508
7.546
27.574
208.08
67.6


I am looking to have a single file that looks something like



F gge0001x gge0001y gge0001z
D 12-30-2006 12-30-2006 12-30-2006
T 14:15:20 14:15:55 14:16:27
S a69 a69 a69
B 15.8 16.1 15
M gge06001 gge06001 gge06001
P 30.1 29.6 29.9
Q 20.2 22.3 23.4
R 1006.2 1003.5 999.8
U 1011.8 1011.8 1005
X 34.7 35.2 35.1
A 38.994 38.994 38.994
G 107.71 107.71 107.71
H 8.395 8.406 8.368
O 37.141 36.823 36.621
C 7.55 7.532 7.437
K 28.193 27.902 27.856
W 212.86 210.15 207.15
L 68.3 67.9 67.6


Yet when I go to paste using paste -d" " temp1 temp2 temp3
I get:



 gge0006zx
12-30-20066
14:06:283
a699
15.74
gge060011
P 30.8 30.6 30.3
Q 19.2 21.1 23.5
R 1006.2 1006.6 1008
U 1012.7 1014.6 1014.1
36.62
A 38.994 38.994 38.994
G 107.71 107.71 107.71
H 8.411 8.433 8.434
O 37.084 36.705 36.508
C 7.537 7.621 7.546
K 28.198 27.623 27.574
W 212.52 210.51 208.08
L 68.1 68 67.6


Which leads me to think that there are some unseen spaces spaces in my files or something like that as I had to sort and copy these three files from other files. I am also missing data, so I am not sure what is going on there either...
If it is the case that there are spaces that I cannot see, is there a way to clear these so that I can get a desirable result?



Any help would be great. Thank you










share|improve this question





















  • If you suspect hidden characters, it's usually a good idea to make them visible. One way is to use sed -n l filename
    – Philippos
    Oct 11 '17 at 7:32












up vote
3
down vote

favorite









up vote
3
down vote

favorite











I am having a little trouble with pasting files. I have three files



temp1



F gge0006x
D 12-30-2006
T 14:05:23
S a69
B 15.4
M gge06001
P 30.8
Q 19.2
R 1006.2
U 1012.7
X 36.2
A 38.994
G 107.71
H 8.411
O 37.084
C 7.537
K 28.198
W 212.52
L 68.1


temp2



gge0006y
12-30-2006
14:05:55
a69
15.3
gge06001
30.6
21.1
1006.6
1014.6
36.1
38.994
107.71
8.433
36.705
7.621
27.623
210.51
68


and temp3



gge0006z
12-30-2006
14:06:28
a69
15.7
gge06001
30.3
23.5
1008
1014.1
36.6
38.994
107.71
8.434
36.508
7.546
27.574
208.08
67.6


I am looking to have a single file that looks something like



F gge0001x gge0001y gge0001z
D 12-30-2006 12-30-2006 12-30-2006
T 14:15:20 14:15:55 14:16:27
S a69 a69 a69
B 15.8 16.1 15
M gge06001 gge06001 gge06001
P 30.1 29.6 29.9
Q 20.2 22.3 23.4
R 1006.2 1003.5 999.8
U 1011.8 1011.8 1005
X 34.7 35.2 35.1
A 38.994 38.994 38.994
G 107.71 107.71 107.71
H 8.395 8.406 8.368
O 37.141 36.823 36.621
C 7.55 7.532 7.437
K 28.193 27.902 27.856
W 212.86 210.15 207.15
L 68.3 67.9 67.6


Yet when I go to paste using paste -d" " temp1 temp2 temp3
I get:



 gge0006zx
12-30-20066
14:06:283
a699
15.74
gge060011
P 30.8 30.6 30.3
Q 19.2 21.1 23.5
R 1006.2 1006.6 1008
U 1012.7 1014.6 1014.1
36.62
A 38.994 38.994 38.994
G 107.71 107.71 107.71
H 8.411 8.433 8.434
O 37.084 36.705 36.508
C 7.537 7.621 7.546
K 28.198 27.623 27.574
W 212.52 210.51 208.08
L 68.1 68 67.6


Which leads me to think that there are some unseen spaces spaces in my files or something like that as I had to sort and copy these three files from other files. I am also missing data, so I am not sure what is going on there either...
If it is the case that there are spaces that I cannot see, is there a way to clear these so that I can get a desirable result?



Any help would be great. Thank you










share|improve this question













I am having a little trouble with pasting files. I have three files



temp1



F gge0006x
D 12-30-2006
T 14:05:23
S a69
B 15.4
M gge06001
P 30.8
Q 19.2
R 1006.2
U 1012.7
X 36.2
A 38.994
G 107.71
H 8.411
O 37.084
C 7.537
K 28.198
W 212.52
L 68.1


temp2



gge0006y
12-30-2006
14:05:55
a69
15.3
gge06001
30.6
21.1
1006.6
1014.6
36.1
38.994
107.71
8.433
36.705
7.621
27.623
210.51
68


and temp3



gge0006z
12-30-2006
14:06:28
a69
15.7
gge06001
30.3
23.5
1008
1014.1
36.6
38.994
107.71
8.434
36.508
7.546
27.574
208.08
67.6


I am looking to have a single file that looks something like



F gge0001x gge0001y gge0001z
D 12-30-2006 12-30-2006 12-30-2006
T 14:15:20 14:15:55 14:16:27
S a69 a69 a69
B 15.8 16.1 15
M gge06001 gge06001 gge06001
P 30.1 29.6 29.9
Q 20.2 22.3 23.4
R 1006.2 1003.5 999.8
U 1011.8 1011.8 1005
X 34.7 35.2 35.1
A 38.994 38.994 38.994
G 107.71 107.71 107.71
H 8.395 8.406 8.368
O 37.141 36.823 36.621
C 7.55 7.532 7.437
K 28.193 27.902 27.856
W 212.86 210.15 207.15
L 68.3 67.9 67.6


Yet when I go to paste using paste -d" " temp1 temp2 temp3
I get:



 gge0006zx
12-30-20066
14:06:283
a699
15.74
gge060011
P 30.8 30.6 30.3
Q 19.2 21.1 23.5
R 1006.2 1006.6 1008
U 1012.7 1014.6 1014.1
36.62
A 38.994 38.994 38.994
G 107.71 107.71 107.71
H 8.411 8.433 8.434
O 37.084 36.705 36.508
C 7.537 7.621 7.546
K 28.198 27.623 27.574
W 212.52 210.51 208.08
L 68.1 68 67.6


Which leads me to think that there are some unseen spaces spaces in my files or something like that as I had to sort and copy these three files from other files. I am also missing data, so I am not sure what is going on there either...
If it is the case that there are spaces that I cannot see, is there a way to clear these so that I can get a desirable result?



Any help would be great. Thank you







linux






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 11 '17 at 2:19









Ububtunoob

252




252











  • If you suspect hidden characters, it's usually a good idea to make them visible. One way is to use sed -n l filename
    – Philippos
    Oct 11 '17 at 7:32
















  • If you suspect hidden characters, it's usually a good idea to make them visible. One way is to use sed -n l filename
    – Philippos
    Oct 11 '17 at 7:32















If you suspect hidden characters, it's usually a good idea to make them visible. One way is to use sed -n l filename
– Philippos
Oct 11 '17 at 7:32




If you suspect hidden characters, it's usually a good idea to make them visible. One way is to use sed -n l filename
– Philippos
Oct 11 '17 at 7:32










1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










At least temp1 and temp2, but possibly temp3 as well, have carriage returns at the end of some of their lines. This causes the output of some lines to move the cursor back to the start of the line before the data from the next file is outputted.



I'm unsure where this could have come from, but it may have been some copy-and-paste procedure that managed to preserve the carriage returns when copying from a file created/edited on a Windows system.



Since it doesn't look like all lines end with carriage returns (r), I'm uncertain if dos2unix would be able to correct the files (you could try it).



The following would remove all r from a file regardless of where they occur:



tr -d 'r' <file >file.tmp && mv file.tmp file



Note too that the expected output of the paste command will be



F gge0006x gge0006y gge0006z
D 12-30-2006 12-30-2006 12-30-2006
T 14:05:23 14:05:55 14:06:28
S a69 a69 a69
B 15.4 15.3 15.7
M gge06001 gge06001 gge06001
P 30.8 30.6 30.3
Q 19.2 21.1 23.5
R 1006.2 1006.6 1008
U 1012.7 1014.6 1014.1
X 36.2 36.1 36.6
A 38.994 38.994 38.994
G 107.71 107.71 107.71
H 8.411 8.433 8.434
O 37.084 36.705 36.508
C 7.537 7.621 7.546
K 28.198 27.623 27.574
W 212.52 210.51 208.08
L 68.1 68 67.6


Most values in your expected output are simply not present in the input.






share|improve this answer




















  • that did it! Thank you so much
    – Ububtunoob
    Oct 11 '17 at 13:54










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',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f397332%2fpasting-files-with-hidden-spaces%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










At least temp1 and temp2, but possibly temp3 as well, have carriage returns at the end of some of their lines. This causes the output of some lines to move the cursor back to the start of the line before the data from the next file is outputted.



I'm unsure where this could have come from, but it may have been some copy-and-paste procedure that managed to preserve the carriage returns when copying from a file created/edited on a Windows system.



Since it doesn't look like all lines end with carriage returns (r), I'm uncertain if dos2unix would be able to correct the files (you could try it).



The following would remove all r from a file regardless of where they occur:



tr -d 'r' <file >file.tmp && mv file.tmp file



Note too that the expected output of the paste command will be



F gge0006x gge0006y gge0006z
D 12-30-2006 12-30-2006 12-30-2006
T 14:05:23 14:05:55 14:06:28
S a69 a69 a69
B 15.4 15.3 15.7
M gge06001 gge06001 gge06001
P 30.8 30.6 30.3
Q 19.2 21.1 23.5
R 1006.2 1006.6 1008
U 1012.7 1014.6 1014.1
X 36.2 36.1 36.6
A 38.994 38.994 38.994
G 107.71 107.71 107.71
H 8.411 8.433 8.434
O 37.084 36.705 36.508
C 7.537 7.621 7.546
K 28.198 27.623 27.574
W 212.52 210.51 208.08
L 68.1 68 67.6


Most values in your expected output are simply not present in the input.






share|improve this answer




















  • that did it! Thank you so much
    – Ububtunoob
    Oct 11 '17 at 13:54














up vote
1
down vote



accepted










At least temp1 and temp2, but possibly temp3 as well, have carriage returns at the end of some of their lines. This causes the output of some lines to move the cursor back to the start of the line before the data from the next file is outputted.



I'm unsure where this could have come from, but it may have been some copy-and-paste procedure that managed to preserve the carriage returns when copying from a file created/edited on a Windows system.



Since it doesn't look like all lines end with carriage returns (r), I'm uncertain if dos2unix would be able to correct the files (you could try it).



The following would remove all r from a file regardless of where they occur:



tr -d 'r' <file >file.tmp && mv file.tmp file



Note too that the expected output of the paste command will be



F gge0006x gge0006y gge0006z
D 12-30-2006 12-30-2006 12-30-2006
T 14:05:23 14:05:55 14:06:28
S a69 a69 a69
B 15.4 15.3 15.7
M gge06001 gge06001 gge06001
P 30.8 30.6 30.3
Q 19.2 21.1 23.5
R 1006.2 1006.6 1008
U 1012.7 1014.6 1014.1
X 36.2 36.1 36.6
A 38.994 38.994 38.994
G 107.71 107.71 107.71
H 8.411 8.433 8.434
O 37.084 36.705 36.508
C 7.537 7.621 7.546
K 28.198 27.623 27.574
W 212.52 210.51 208.08
L 68.1 68 67.6


Most values in your expected output are simply not present in the input.






share|improve this answer




















  • that did it! Thank you so much
    – Ububtunoob
    Oct 11 '17 at 13:54












up vote
1
down vote



accepted







up vote
1
down vote



accepted






At least temp1 and temp2, but possibly temp3 as well, have carriage returns at the end of some of their lines. This causes the output of some lines to move the cursor back to the start of the line before the data from the next file is outputted.



I'm unsure where this could have come from, but it may have been some copy-and-paste procedure that managed to preserve the carriage returns when copying from a file created/edited on a Windows system.



Since it doesn't look like all lines end with carriage returns (r), I'm uncertain if dos2unix would be able to correct the files (you could try it).



The following would remove all r from a file regardless of where they occur:



tr -d 'r' <file >file.tmp && mv file.tmp file



Note too that the expected output of the paste command will be



F gge0006x gge0006y gge0006z
D 12-30-2006 12-30-2006 12-30-2006
T 14:05:23 14:05:55 14:06:28
S a69 a69 a69
B 15.4 15.3 15.7
M gge06001 gge06001 gge06001
P 30.8 30.6 30.3
Q 19.2 21.1 23.5
R 1006.2 1006.6 1008
U 1012.7 1014.6 1014.1
X 36.2 36.1 36.6
A 38.994 38.994 38.994
G 107.71 107.71 107.71
H 8.411 8.433 8.434
O 37.084 36.705 36.508
C 7.537 7.621 7.546
K 28.198 27.623 27.574
W 212.52 210.51 208.08
L 68.1 68 67.6


Most values in your expected output are simply not present in the input.






share|improve this answer












At least temp1 and temp2, but possibly temp3 as well, have carriage returns at the end of some of their lines. This causes the output of some lines to move the cursor back to the start of the line before the data from the next file is outputted.



I'm unsure where this could have come from, but it may have been some copy-and-paste procedure that managed to preserve the carriage returns when copying from a file created/edited on a Windows system.



Since it doesn't look like all lines end with carriage returns (r), I'm uncertain if dos2unix would be able to correct the files (you could try it).



The following would remove all r from a file regardless of where they occur:



tr -d 'r' <file >file.tmp && mv file.tmp file



Note too that the expected output of the paste command will be



F gge0006x gge0006y gge0006z
D 12-30-2006 12-30-2006 12-30-2006
T 14:05:23 14:05:55 14:06:28
S a69 a69 a69
B 15.4 15.3 15.7
M gge06001 gge06001 gge06001
P 30.8 30.6 30.3
Q 19.2 21.1 23.5
R 1006.2 1006.6 1008
U 1012.7 1014.6 1014.1
X 36.2 36.1 36.6
A 38.994 38.994 38.994
G 107.71 107.71 107.71
H 8.411 8.433 8.434
O 37.084 36.705 36.508
C 7.537 7.621 7.546
K 28.198 27.623 27.574
W 212.52 210.51 208.08
L 68.1 68 67.6


Most values in your expected output are simply not present in the input.







share|improve this answer












share|improve this answer



share|improve this answer










answered Oct 11 '17 at 6:25









Kusalananda

105k14209326




105k14209326











  • that did it! Thank you so much
    – Ububtunoob
    Oct 11 '17 at 13:54
















  • that did it! Thank you so much
    – Ububtunoob
    Oct 11 '17 at 13:54















that did it! Thank you so much
– Ububtunoob
Oct 11 '17 at 13:54




that did it! Thank you so much
– Ububtunoob
Oct 11 '17 at 13:54

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f397332%2fpasting-files-with-hidden-spaces%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)