3

I am looking for an exchange on the main site from about two years ago.

It was I think a short comment from Terdon.

The question asked for some text processing usage. A number of people (maybe including Terdon) gave short one line answers, some using standard *nix text-processing tools like awk, maybe some less known newer tools also.

One answer gave a longish Python answer -- 30 lines or so.

Terdon asked "Why on earth would you do this when the simple one-liners exist?" (Obviously I dont remember the exact wording he used!)

The answer-er replied: Because I like Python (And by implication dont like other things...)

Context

I am a teacher of programming and started (with learning) Fortran... Pascal in the early 80s. As a teacher I've probably learnt and taught dozens of languages. Started using Python in the early 2000s. At that time I found it neat and sweet. But of late I am finding that while that may be so, the culture around Python is not very conducive for a well-rounded CS education.

I am trying to collect data on this though I guess this question is a bit of "Please help me find a needle in a haystack". So even if finding the exact exchange is very hard I was wondering if people here may be able to come up with nifty SEDE queries that reduce the haystack somewhat!

13
  • do you remember if you replied, commented, or even bookmarked the question/answer? By bookmark I mean using the site feature, not your browser, but I guess that could work too. Aug 13 at 15:10
  • No @NordineLotfi : I did nothing (other than note it as interesting in my own head 😁)
    – Rusi
    Aug 13 at 15:20
  • I searched on one of the stack data dump (the one for unix.SE) and found 4709 comment that match the word (both in upper and lowercase) "python". If that doesn't work, either terdon can shed some past wisdom/memory on this, or maybe one could filter by python answer for all unix's post. Aug 13 at 15:44
  • @NordineLotfi thanks for trying. "python" alone will produce a huge haystack of course; python+terdon (comment) should be a minimum. You are not using SEDE?
    – Rusi
    Aug 13 at 15:52
  • No, I'm not using SEDE (not to my taste and I only know one person on meta.SE who is expert at it). I'm using one of the data dump from stack, you can find them here. I only had to make my own tool for it in python to parse it. Aug 13 at 15:57
  • @Rusi re: your flag, I'm happy to move your question to Meta.SE (where there's a data-explorer tag), but I don't think it's off-topic here, given that you're looking for a U&L post.
    – Jeff Schaller Mod
    Aug 13 at 16:39
  • Are you trying to find the python answer or my (kind of obnoxious, sorry) comment? The comment has likely been deleted.
    – terdon Mod
    Aug 13 at 16:43
  • Stack Exchange Data Explorer can help, but we can't migrate there, it isn't a site for questions, it's a site that lets you craft DB queries to find stuff on the various SE sites.
    – terdon Mod
    Aug 13 at 16:49
  • I already mentioned I made a tool for myself to use the stack data dump -- so would anyone object if I recommend/mention it on an answer to this post? (it's not good or anything but it could help the OP find their wanted post) Aug 13 at 16:57
  • @terdon "Comment deleted"... Oh! I wanted that comment in the context of (an especially) clunky answer 😈
    – Rusi
    Aug 13 at 16:59
  • @terdon JFTR I don't think there was anything obnoxious in your comment... The "...on earth..." is (probably) my addition. If I remember it was just "Why would/do you do this?" I have spent time with SE search as well as google before asking...
    – Rusi
    Aug 13 at 17:10
  • Ah, glad to hear that. I've been known to be obnoxious :) I admit I do have a vague recollection of seeing a needlessly complex multi-line python script as an answer to something that could be done very simply with one-liners, but I am not sure it was only once. If you can find the answer, I can give you a screenshot of the deleted comments (mods can see deleted comments).
    – terdon Mod
    Aug 13 at 17:33
  • @terdon for my purposes any such answer will do!
    – Rusi
    Aug 13 at 17:36

2 Answers 2

4

I made a SEDE query that searches comments posted by a given user ID (you can find a user's user ID by clicking on their profile; for instance, mine is https://unix.stackexchange.com/users/22222/terdon so my UID is 22222) and containing three strings. I then searched with my user ID and the string why, would and python which returned only 4 hits, one of which may well be the one you were thinking of:

I don't understand why you would make something this complex. For recursion, use either bash's (or your shell's equivalent) globstar option and ** globs or find. For a dry run, just use sed. Unless you use the -i option, it won't make any changes. For a backup use sed -i.bak (or perl -i .bak); for files that don't match, use grep PATTERN file || echo file. And why in the world would you have python expand the glob instead of letting the shell do it? Why script.py --glob=foo* instead of just script.py foo*? – terdon ♦ Nov 23, 2017 at 9:34

3
  • 1
    Looks like the one!!! 🥰 Many Many thanks @Terdon
    – Rusi
    Aug 13 at 17:58
  • I actually found that one in the 4709 matches I mentioned, so that's nice Aug 13 at 18:00
  • @NordineLotfi I find haystacks ok.... From a safe distance 😛
    – Rusi
    Aug 13 at 18:03
1

I don't think it's what you want but, here is the tool I made (the one I mentioned in the comments).

For anyone who didn't look into the comments, this is a tool that converts the stack data dump from archive.org to plaintext (with some minor formatting, details in the readme)

It's horribly written but it works (the main cons besides syntax/language semantic is the time it takes, but it's really fast for unix.SE, so that's fine)

you can then (based on the formatting decision I made) decide to use grep, or any other tools, or strategy and some beverage/snacks of your choice to wait for when it finish. Good luck.

4
  • Tnx I'll try it.
    – Rusi
    Aug 13 at 17:17
  • btw, the command I used to get the previously mentioned 4709 matches was grep "^COMMENT:" unix.stackexchange.com.md | grep python | wc -l @Rusi Just FYI Aug 13 at 17:27
  • 3
    Why on earth would you use grep python | wc -l when grep -c python exists? Sorry, I couldn't resist :P
    – terdon Mod
    Aug 13 at 17:51
  • I knew this would bait someone ;) but on a serious note, it's by habit. Sorry :) @terdon Aug 13 at 17:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .