-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to set a default delimiter #44
Comments
I'd support an environment variable to set this. One trick you may not be aware of (and it may not work for your use case), but if your csv files have a |
Oh, that's cool, I was indeed not aware of that. Unfortunately a lot of files I work with don't have a But an environment variable for that would be totally awesome! |
Maybe environment variables based on awk variable names would be a good idea:
An environment variable for specifying additional file extensions for automatically interpreting files as TAB-separated files, would be useful too. A lot of bioinformatic related file formats are TAB-separated file formats.
|
How about defaulting to automatic separator detection? Separator is either ',' or '\t', whichever comes first. |
@ilabdsf Won't work because escaping/quoting permits either of those characters to be present before the first field separator. |
@BurntSushi right, that is why I say "default to". If someone wants a robust script, he can write "-d,". But when just using xsv from the command line, I think it is acceptable. It is very unlikely to have have tabs or commas in column names. |
A bash function can be setup to always use a specific delimiter: function xsvt() {
local cmd=$1
shift && command xsv $cmd -d"\t" $@
} |
I vote for an environmental variable that can set the default input/output for all of the pipes maybe just something like |
@iliekturtles Some things that don't work:
|
Not sure if you take pull requests or not, but I created one for my proposal. I have not written much rust code, but I thought that this seemed easy enough things to dive and and learn some. I was thinking about trying to document the variable somewhere, but was not really sure where. Do you want me to put it into all of the help strings? |
@BurntSushi can you take a look at #94 ? |
|
The main issue for me is that the output delimiter cannot always be configured. If I get some TSV files (with embedded commas), and do something like So to make everything composable, it would be great if an env delimiter influences both input and output. |
@nickray You can add |
I didn't realize that
Good to know it's not!
Would still be helpful to avoid the quotation dance, and use tabs (or 0x1f) throughout by just doing something like |
Any updates? |
OK, can I just say first of all that I'm IN LOVE with this toolkit!? It is an absolute joy and it fills a gaping void for me! ;]
Anyway, I work with a lot of TSV files (tab-separated) and it's kind of annoying to have to type
-d "\t"
for every single command I run (but thank you for providing the option!). I'd love to be able to change the default separator from,
to\t
.Unfortunately it's not easy to alias since the
-d
must come AFTER the command. I suppose I could do something likexsvtab() { xsv $1 -d "\t" ${@:2}; }
(and maybe evenalias xsv=xsvtab
if I'm feeling really lazy - but then I lose the ability to override the delimiter if I actually do have a different type of file and I have to run it with\xsv
to use the original command instead of the alias (specifying-d
again with the above alias results in anInvalid arguments.
error because now-d
is specified twice)). That all feels a little clunky, although it does kind of work for my use case, it would just be slicker to be able to override the default.The text was updated successfully, but these errors were encountered: