-
Notifications
You must be signed in to change notification settings - Fork 78
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
Regexp exercise 15): solution improvement #7
Comments
There were some bugs in the original awk code I provided, they occurred because I had to re-write them here in the issue as I couldn't copy-paste them. The CLI app doesn't allow selecting any content. I see this as an issue - should I open a new one here on GitHub? Or is that inherent to that kind of application? Anyway, my awk code should now be bug-free and yielding the same output as yours. |
Your solution won't work for input like Regarding last-but-second:
Regarding the CLI app, I don't know if there's a way to select content. I could probably add a button/short-cut to copy the content in the Input box, but other than that I doubt I'll be able to add other features. I'm using a third-party Python module for that app and I'm not really familiar with it. |
Building upon your idea, I think |
Thanks for the reply! About an hour after asking I realized that I was making use of fields, but wasn't at the computer to reply. Anyway, I'm still a newcomer to awk, so I'll try forgiving myself this mistake. Here's an interesting link regarding "last but second". |
First of all, thanks for the great tutorial and the CLI app for exercising!
Sorry, I accidentally pressed Submit before finishing my issue. Here's the rest.
In question 21/88, i.e. exercise 15) of the Regular Expressions section, the proposed solution is this:
learn_gnuawk/exercises/Exercise_solutions.md
Lines 244 to 250 in 96b8442
Isn't this a shorter solution:
awk '/(.*ar.*){3,}/{print gensub(/ar/, "X", NF-2)}' patterns.txt
Also, is the phrasing "last but second" correct? I was rather confused. Is the intended meaning the same as that of the word "antepenultimate"?
The text was updated successfully, but these errors were encountered: