Sorry for the maybe trivial question.
I fought a bit with the unix join command, trying to get tabs instead of whitespaces as the default separators. -t is the argument, but these don't work (ubuntu 9.10 64 bit 2.6.31-14, GNU coreutils version 7.4)
join file1 file2 -t"\t"
join file1 file2 -t="\t"
join file1 file2 -t="\\t"
join file1 file2 -t $"\t"
Et cetera. Of course, I can always use some inelegant solution like
join file1 file2 > output
sed "s/ /\t/g" output
But I wanted to look smart :-) Moreover, if there's a -t argument, it must work.
What is the join command in UNIX? The join command in UNIX is a command line utility for joining lines of two files on a common field. It can be used to join two files by selecting fields within the line and joining the files on them. The result is written to standard output.
To specify a field separator for joining using the joincommand use the -toption. An example is a CSV file where the separator is ,. In the following example there are two files names.csvand deposits.csv.
The join command in UNIX is a command line utility for joining lines of two files on a common field. It can be used to join two files by selecting fields within the line and joining the files on them. The result is written to standard output. How to join two files
1. using -a FILENUM option : Now, sometimes it is possible that one of the files contain extra fields so what join command does in that case is that by default, it only prints pairable lines.
I think it takes a variable generated on-the-fly
Try
join file1 file12 -t $'\t'
You can enter tab by pressing CTRL+v Tab
join -t '<CTRL+v><Tab>' file1 file2
join -t "`echo '\t'`" file1 file2
ps: on my machine, Red Hat Enterprise Linux Server release 5.1 (Tikanga), the command join -t $'\t' file1 file2
returns "Illegal variable name".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With