ԜаӀtеr Ⅼарсһуnѕkі

sometimes thinking in reverse is the best. i was trying to figure out someway to get regex to remove a bunch of information in parentheses in a text file and because there were several on each line i was getting hung up, since regex is greedy and would eat everything from the first open paren to the last closed. solution: look for everything that's not a closed paren, i.e. `sed 's|([^)]*)|d'`

um, ok, i lied a little. that's what i get for changing things after the fact. `d` deletes lines in `sed`, so what i meant was `sed 's|([^)]*)||g'` so it's just replacing the match with nothing and making the change globally.

@wxl You know what's pretty cool about regexes?
You can talk to people that have been UNIX-sysadmins since they had to because their mainframes were becoming out of fashion and they'll still go "yeah, I don't know how that magic works". :-D

@b9AcE right?! I about split my head trying to figure that out. And some people think `vi` is hard…

@wxl A lot of people think getting out of typing "q" before ":" in vi is hard. ;-D

@wxl Well, the fail-safe for me, in modern times, is simply "<ctrl>+z → kill %1". :-]

Sign in to participate in the conversation
soc.ialis.me mastodon

A generalistic Mastodon instance hosted in France, open to all and available since the 9 April 2017. Learn about the instance information and guidelines.