Manipulate output join command linux
Hey guys, I used the join command to join two tab separated text files on a common field. This worked perfectly fine except for the output. I expexted something like:
File A:
1 A
2 B
3 C
File B:
1 a
2 B
3 C
New file:
1 Aa
2 Bb
3 Cc
However, I got an output file which printed the common field of file B below the field of file A instead of right next to it:
1 A
a
2 B
b
3 C
c
I have no clue why and played around with the ouput parameter but nothing worked so far. Do you have an idea how I can change that? Thanks in advance!
• 497 views
•
link
0 answers
No answers yet.
Log in to answer this question.
Please highlight data examples and code with markdown / code option
huh, that should not happen (normally).
join file1 file2should print both shared values in single line.are there any hidden chars in your file? did you process them in a DOS/windows environment at any time? if so you'll likely will have to convert them back to linux format (eg. use
dos2unixfor instance). What output do you get if you run the commandpaste file1 file2You will in any case also have to do some 'postprocessing' on the join output as it does not print values next to each other, but uses the input column separator.
Yes, I am bit confused as well since it worked fine for me in the past,...I checked for chars but couldn't find anything. But I will try to convert back to linux, thanks.
I tried the paste command and it starts printing the content of the two files. Is that what it should do?
Thanks again for the help.
about the paste command: yes it should print the 'elements' of both files/lists on a single line, with first from file1 next to first of file 2, second file 1 next to second file2 .... , If it does not do that (and prints them on separate lines ) it means you have hidden chars in your files.
Hello marlenejensen!
We believe that this post does not fit the main topic of this site.
not related to bioinformatics
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!