gargs
gargs copied to clipboard
Provide a way to escape the placeholder(s)
How would one run a command that includes {} or {1}? e.g.:
cat filenames.txt | gargs "find . -type f -name '{}' -exec rm {} \;"
where the first {} should be interpolated and the second should not?
xargs allows the substitution token to be customized with the -I option, as does GNU parallel. The latest version of map allows its substitution token (%) to be escaped in the same way as sprintf (%%).
Currently, gargs doesn't provide a way to do this for {}, or for {1}, {2} etc. I haven't run into this yet with gargs, but I've run into it in the past with xargs (and with map).
thanks for the interest. For now, gargs sacrifices some functionality of ease-of-use and implementation.
I agree that most of these would be useful, but I haven't had a need for them and so I likely won't implement--again for the sake of ease-of-use.
@shenwei356 has a very nice implementation of a command processor that has a lot more functionality and might be more what you are looking for https://github.com/shenwei356/rush
gargs + jq would be a powerful toolset to process json but the {} is killing it at the moment.