Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Join command in Bash

I community. I’ve got a problem with bash terminal. There are two files that I need to merge and I want to use delimiter ; in join command, but it doesn’t work. How can I fix it? Thanks!

join -1 2 -2 2 -t; tasks.txt procowner.txt > answ.txt 

upd. bash message

join: option requires an argument -- t
usage: join [-a fileno | -v fileno ] [-e string] [-1 field] [-2 field]
            [-o list] [-t char] file1 file2
zsh: command not found: tasks.txt

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The ; is treated as a command terminator by bash. This in turn means bash sees two separate commands:

join -1 2 -2 2 -t

# and

tasks.txt procowner.txt > answ.txt 

The first one generates a syntax error for the join command; the second one generates an error stating tasks.txt is not a valid command.

The simple fix is to quote the ;, eg:

join -1 2 -2 2 -t';' tasks.txt procowner.txt > answ.txt 
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading