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

04-pipefilter: Excluding Characters Using Wildcard Expression #686

stegalvan opened this Issue Jan 23, 2018 · 3 comments


None yet
4 participants

stegalvan commented Jan 23, 2018

In the lesson "Pipes and Filters" it is explained that in the wildcard expression *[AB].txt, [AB] matches either an ‘A’ or a ‘B’. During a workshop where I was helping, it was asked if it is possible to exclude one character in a similar way.

This is indeed possible using the character '^'. For instance, with the example at hand, *[AB].txt is equivalent to *[^Z].

I think that this is an useful information to add, maybe in a callout box.
Moreover, the pattern to explain how to include/exclude results is already followed for other commands, such as grep (using the -v option to select non-matching lines).

I'm available to add it to the lesson if there is agreement that this can improve it.


This comment has been minimized.


colinmorris commented Feb 1, 2018

Thanks for the suggestion. That is a neat bit of syntax, but we tend to be pretty conservative about adding additional content to the lesson (even little bits like this).

Do you think this syntax is something learners are likely to go on to use regularly? My feeling is that even the basic [AB] syntax is pretty obscure (I was aware of the similar thing in regular expressions, but didn't know it could be used in wildcards until I taught this lesson). But I'm willing to be convinced otherwise - my shell usage might not be representative of the wider world.


This comment has been minimized.


gcapes commented Feb 2, 2018

I think you have to draw the line somewhere. Sure it's useful, but in the same way that some 'taster' regex is used later on, this should just be a taster of bracket pattern matches. Perhaps a link to something like this could be justified because it doesn't really add any length to the lesson:


This comment has been minimized.

stegalvan commented Feb 10, 2018

Thanks for the feedback. I don't know if this "advanced" globbing is something that learners are likely to use regularly. Admittedly, I don't use it much myself, but I'm working with the shell mainly for system administration and not for data processing.

My initial thought was more about providing an inclusion/exclusion usage for it, optional and based on the audience interests. But I appreciate that this line of reasoning can escalate pretty quickly and make the lesson material confusing.

I think that the idea to include a link to an in-depth description of the wildcards usage is great. My only concern about that specific guide is that there is a typo exactly in the example about the exclusion. Do you think that this can be a problem? can be an alternative (using [!] instead of [^]).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment