Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

split.sh: append .vcf suffix, only, to end of file #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mdengler
Copy link

This commit makes the output files of split.sh end in .vcf and strips any internal ".vcf":

$ split.sh bigfile.vcf
$ ls
bigfile.vcf
bigfile-00000000.vcf
bigfile-00000001.vcf
bigfile-00000002.vcf
...

Currently in l0b0/vcard/master, split.sh results in:

$ split.sh bigfile.vcf
$ ls
bigfile.vcf
bigfile.vcf00000000
bigfile.vcf00000001
bigfile.vcf00000002
...

@mdengler mdengler changed the title split.sh: append .vcf suffix only to end of file split.sh: append .vcf suffix, only, to end of file Jan 15, 2015
@l0b0
Copy link
Owner

l0b0 commented Jan 15, 2015

Thanks for the patch, it would be a good addition for human-readable filenames. But I think it would have to be a non-default option - it's easier to use the original code with other scripts, since it's easier to parse a number at the end of the filename than in the middle. I'd suggest using getopt to parse parameters, like this script, and adding either --digits=8 or --suffix-format "-%08d.vcf" to the csplit options.

@mdengler
Copy link
Author

Fair enough -- I didn't see that split.sh was used with other scripts. I've always used basename and cut for this type of parsing in scripts. I find leaving the file extension (which has many other uses) and using my suggested suffix that starts with a "-" is easy to read for humans and to parse for scripts: a little basename ... .vcf here and a cut -d- -f... there and there is a lot one can do.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants