3 ms·
I'm going through the AWK book and join is in there. I was unhappily surprised to find that using a tab as a delimiter is painful with join. Variations to over
by cptnapalm 7y ago
I'm going through the AWK book and join is in there. I was unhappily surprised to find that using a tab as a delimiter is painful with join.
Variations to overcome this which I've bumped into:
join -t $'\t' file1 file2 (BASH only, I think.)
join -t '<CTRL+v><Tab>' file1 file2
join -t "`echo '\t'`" file1 file2
Why 'join -t '\t' file1 file2' is apparently beyond the pale has me mystified.
- loeg 7y agoGiven that the delimiter must be a single character and the intended use is in shells, I am equally mystified as to why control codes must be passed literally. Join is smart enough to reject 2 character delimiters, but could easily grok escapes if it so chose: $ join -t '\t' join: illegal tab character specification
- JdeBP 7y agoSee https://unix.stackexchange.com/a/65819/5132 https://unix.stackexchange.com/a/65819/5132 for some thinking on making every individual program have an escape sequence parser, and why that syntax is not specific nor original to the Bourne Again shell.
- cptnapalm 7y agoFound a link in your link to something by a Sven Mascheck and found out there is a printf command. Despite having started using Linux in 1997, I still find new things.