|
gonadic io posted:Speaking of terrible programmers, this is a pro click: https://github.com/CocoaPods/CocoaPods/issues/4989#issuecomment-193772935 real q: how is this different from homebrew and like the go language package manager. I guess they don't do shallow fetching but I'm pretty certain they use GitHub as a cdn
|
# ? Mar 8, 2016 21:54 |
|
|
# ? May 24, 2024 02:37 |
|
the github dude in that thread mentions that they had to work with the homebrew people on something similar
|
# ? Mar 8, 2016 21:59 |
|
imo why blame these innocent programmers for Linus' mistake
|
# ? Mar 8, 2016 21:59 |
anthonypants posted:ok thanks Okay so after spending a little too much time on this, I think I have it figured out. A sed expression of the form '/regexA/,/regexB/' matches everything from an occurrence of regexA to regexB. A null regex (//) is equivalent to the previous regex used. So an expression of the form '/regex/,//' matches everything the regex, and then everything up to and including the next occurrence of the regex. In this case, that matches this: pre:zone "example.com" IN { type master; file "db.example.com"; pre:zone "example.com" IN { file "db.example.com"; IMO this is a really weird and roundabout way of doing things, and if I was going to use sed for this I would probably write something like code:
PS this was a hugely helpful reference for me in figuring this out. VikingofRock fucked around with this message at 22:58 on Mar 8, 2016 |
|
# ? Mar 8, 2016 22:56 |
|
VikingofRock posted:Okay so after spending a little too much time on this, I think I have it figured out. A sed expression of the form '/regexA/,/regexB/' matches everything from an occurrence of regexA to regexB. A null regex (//) is equivalent to the previous regex used. So an expression of the form '/regex/,//' matches everything the regex, and then everything up to and including the next occurrence of the regex. In this case, that matches this: here is the best sed advice you will ever read: don't loving use sed for anything, ever. or awk or bash (except as an interactive shell) we have plangs now and they do everything the old unix utilities can do better. like seriously i once replaced a ~bespoke artisanal ksh script~ with like three lines of perl and it ran something like 1000x faster as well, because amazingly enough programming with a programming language is better than programming with a bunch of random dsls talking to each other over untyped character streams even when the programming language in question is goddamn perl
|
# ? Mar 8, 2016 23:24 |
|
I weep for you if the bash script became a performance bottleneck
|
# ? Mar 8, 2016 23:30 |
|
Soricidus posted:here is the best sed advice you will ever read: don't loving use sed for anything, ever. awk at least is v good for getting what you need out of huge log files. for very nearly any other purpose it is bad though
|
# ? Mar 8, 2016 23:40 |
|
who needs grep! just pipe everything to splunk, set up a custom event to trigger when the relevant
|
# ? Mar 8, 2016 23:42 |
|
Soricidus posted:even when the programming language in question is goddamn perl the last time i saw perl was when a coworker wrote this to identify distinct file extensions in a git repo: pre:find . -type d -name '.git' -prune -o -type f -printf '%f\0' | \ perl -CSDA -Mutf8 -0 -l0 -n -e 'print /(\..+)/ ? $1 : $_ ;' | \ sort -u -z | \ perl -CSDA -Mutf8 -0 -l12 -n -e 's/\p{XPosixCntrl}/�/g ; print $_ ;' i'm also the assumptions regarding UTF-8
|
# ? Mar 8, 2016 23:48 |
|
Weep away, I recently replaced a system that was 8k lines of bash and stored procs (that took 2-3 hours) with 600 lines of scala that takes about 10 seconds.
|
# ? Mar 8, 2016 23:51 |
|
Soricidus posted:here is the best sed advice you will ever read: don't loving use sed for anything, ever. perl's shipped with complete sed-to-perl and awk-to-perl translators since i think the beginning
|
# ? Mar 8, 2016 23:53 |
|
gonadic io posted:Weep away, I recently replaced a system that was 8k lines of bash and stored procs (that took 2-3 hours) with 600 lines of scala that takes about 10 seconds. Please don't say you just dumped the table and re-implemented the stored proc in Scala?
|
# ? Mar 9, 2016 00:03 |
|
MrMoo posted:Please don't say you just dumped the table and re-implemented the stored proc in Scala? Stored procS Nobody's really sure what it was doing but dozens of temporary tables were created I think. It was parsing a bank's end of day files and inserting them into the db so I just threw away the entire thing away and reimplemented it in Scala with an orm
|
# ? Mar 9, 2016 00:11 |
|
JawnV6 posted:who needs grep! just pipe everything to splunk, set up a custom event to trigger when the relevant this sounds like a request from offshore. "please trigger when the relevant"
|
# ? Mar 9, 2016 00:12 |
|
JewKiller 3000 posted:this sounds like a request from offshore. "please trigger when the relevant"
|
# ? Mar 9, 2016 00:30 |
|
gonadic io posted:Stored procS you don't seem to understand, we actually like stored procedures in here
|
# ? Mar 9, 2016 01:21 |
|
gonadic io posted:Speaking of terrible programmers, this is a pro click: https://github.com/CocoaPods/CocoaPods/issues/4989#issuecomment-193772935
|
# ? Mar 9, 2016 01:25 |
|
speaking of sed, about the most common thing i do with ad-hoc shell commands is stuff like "here is a list of urls, extract this query field to pipe through sort/uniq", or "here are a bunch of log lines, extract the numbers to run statistics" i usually do something like sed 's/^.*[&?]foo=\([^&]*\).*$/\1/' is there a better tool for this? jq is an amazing tool if you have a lot of data in json, btw
|
# ? Mar 9, 2016 03:23 |
|
suffix posted:speaking of sed, i do this kind of thing with perl/ruby/python. it's no harder than writing a shell pipeline, and it's easier to dump my command history into a real script when i need to. for example, to get sed behavior out of perl: code:
|
# ? Mar 9, 2016 03:29 |
IMO stuff like sed and awk and grep are great for one-off one-liners in an interactive shell, and are probably a useful skill to have if you spend a lot of time on the command line. If you need to write more than a line of bash though you should instead use a more modern scripting language.
|
|
# ? Mar 9, 2016 03:48 |
|
why learn two lovely, single-purpose tools if you can learn to use a p-lang at the cli instead
|
# ? Mar 9, 2016 04:06 |
|
Notorious b.s.d. posted:why learn two lovely, single-purpose tools if you can learn to use a p-lang at the cli instead correct.
|
# ? Mar 9, 2016 04:42 |
|
i got a 20k raise which makes me think I should have asked for more
|
# ? Mar 9, 2016 05:42 |
|
uncurable mlady posted:i got a 20k raise which makes me think I should have asked for more gj man
|
# ? Mar 9, 2016 05:52 |
|
uncurable mlady posted:i got a 20k raise which makes me think I should have asked for more lol nice 5 figgy raise fucktard
|
# ? Mar 9, 2016 05:56 |
|
jk congrats
|
# ? Mar 9, 2016 05:56 |
|
fucktard
|
# ? Mar 9, 2016 05:56 |
|
oh come on mr president, what would you have to do to get an extra 20k from epic? threaten to move to somewhere hip, like milwaukee?
|
# ? Mar 9, 2016 06:05 |
Notorious b.s.d. posted:why learn two lovely, single-purpose tools if you can learn to use a p-lang at the cli instead Same reason you would learn any other tool--they are kind of nice for their (admittedly niche) domain. I'll admit that I don't know perl, but what you wrote in perl doesn't really seem any nicer than what I wrote in sed, and the equivalent python/ruby/whatever wouldn't be a one-liner so it'd be marginally more effort for something that doesn't need to be marginally more effort. I mean it's not like the basics of awk and sed are that complicated, so if you often find yourself in a situation where they would be nice, why not spend the half hour requried to learn them? (Admittedly I only learned them because my undergraduate advisor used them often in code that I needed to maintain, but they have occasionally been useful since then so I don't regret learning them).
|
|
# ? Mar 9, 2016 06:31 |
|
is sed and awk just regex for i/o?
|
# ? Mar 9, 2016 07:33 |
|
MeruFM posted:is sed and awk just regex for i/o? I'm pretty sure sed is Turing complete. e: have a Tetris https://github.com/uuner/sedtris
|
# ? Mar 9, 2016 07:36 |
MeruFM posted:is sed and awk just regex for i/o? Sed is a regex-based tool that is mostly used to transform text files from the command line, and to pull information out of them (like in the example that was linked upthread). It has almost identical syntax to substitution in vim, if you have ever used that. Awk is mostly used for dealing nicely with simple column-based data, again from the command line. The advantage of sed and awk is that they tend to allow very concise syntax for dealing with their respective use cases, which is nice for bash one-liners. Both can also be (mis)used as full-fledged programming languages in their own right, but as others have mentioned if you need these capabilities you should definitely be reaching for something a little more modern. edit: leper khan posted:I'm pretty sure sed is Turing complete. This is awesome and horrifying.
|
|
# ? Mar 9, 2016 07:57 |
|
This is my take on awk, with a 20 mins tutorial: http://ferd.ca/awk-in-20-minutes.html
|
# ? Mar 9, 2016 08:03 |
|
sed stands for "stream editor" and is used for applying regex substitutions to files as in "sed -i 's/cloud/butt/g' article.txt" awk stands for "aho weinberger kernighan" whose phd thesis involves the extraction of whitespace-separated data from files. the eponymous program is used like "cat piss | awk '{print $3}'". this is the only known use of the awk program.
|
# ? Mar 9, 2016 08:03 |
|
i remember this now my advisor had a hardon for awk and would write fairly large programs in it. I think she tried to make me write one-liners instead of using notepad++ regex find-replace.
|
# ? Mar 9, 2016 08:09 |
MononcQc posted:This is my take on awk, with a 20 mins tutorial: http://ferd.ca/awk-in-20-minutes.html I've read this article before, but I'm gonna read it again because it is really good.
|
|
# ? Mar 9, 2016 08:17 |
|
MeruFM posted:i remember this now :bufdo %s/dumbshit/dumbershit/ge
|
# ? Mar 9, 2016 08:19 |
|
[dicks]
|
# ? Mar 9, 2016 08:21 |
|
MALE SHOEGAZE posted:yeah it's real good if you do this someone will complain in 6-12 months when their cowboy feature branch suddenly can't be pushed and they'll refuse to redo their work on the new repo.
|
# ? Mar 9, 2016 08:21 |
|
|
# ? May 24, 2024 02:37 |
|
VikingofRock posted:Okay so after spending a little too much time on this, I think I have it figured out. A sed expression of the form '/regexA/,/regexB/' matches everything from an occurrence of regexA to regexB. A null regex (//) is equivalent to the previous regex used. So an expression of the form '/regex/,//' matches everything the regex, and then everything up to and including the next occurrence of the regex. In this case, that matches this: code:
|
# ? Mar 9, 2016 13:24 |