You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part 1 was giving the wrong result because of globbing
Rewritten to use bash regex instead of recursive grep -o (5-6x speedup)
Part 2 made a fast one-liner
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -91,7 +91,7 @@ Description of what I'm doing. Contains spoilers....
91
91
92
92
### 18.sh
93
93
Have to turn glob off, or \* will be replaced with all files in directory.
94
-
1.Recursive grep to find a brackets that don't contain inner brackets. Calculate those. Replace the whole bracket with calculated result. Repeat. Slow but works.
94
+
1.Bash regex to find a bracket that doesn't contain inner brackets. Calculate that. Replace the whole bracket with result. Repeat until no brackets remain. Slow, but faster than grep -o.
95
95
2. Just replace "\*" with ")\*(" to change the precedence. Add "(" and ")" to the ends to close off the brackets.
0 commit comments