Skip to content
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

Provide a way to escape the placeholder(s) #9

Open
chocolateboy opened this issue Sep 2, 2017 · 2 comments
Open

Provide a way to escape the placeholder(s) #9

chocolateboy opened this issue Sep 2, 2017 · 2 comments

Comments

@chocolateboy
Copy link

chocolateboy commented Sep 2, 2017

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).

@brentp
Copy link
Owner

brentp commented Sep 2, 2017

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

@mterron
Copy link

mterron commented Dec 8, 2019

gargs + jq would be a powerful toolset to process json but the {} is killing it at the moment.

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

No branches or pull requests

3 participants