this post was submitted on 07 Apr 2025
490 points (99.0% liked)

linuxmemes

24401 readers
539 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack users for any reason. This includes using blanket terms, like "every user of thing".
  • Don't get baited into back-and-forth insults. We are not animals.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry will not be tolerated.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn, no politics, no trolling or ragebaiting.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, <loves/tolerates/hates> systemd, and wants to interject for a moment. You can stop now.
  • 5. πŸ‡¬πŸ‡§ Language/язык/Sprache
  • This is primarily an English-speaking community. πŸ‡¬πŸ‡§πŸ‡¦πŸ‡ΊπŸ‡ΊπŸ‡Έ
  • Comments written in other languages are allowed.
  • The substance of a post should be comprehensible for people who only speak English.
  • Titles and post bodies written in other languages will be allowed, but only as long as the above rule is observed.
  • 6. (NEW!) Regarding public figuresWe all have our opinions, and certain public figures can be divisive. Keep in mind that this is a community for memes and light-hearted fun, not for airing grievances or leveling accusations.
  • Keep discussions polite and free of disparagement.
  • We are never in possession of all of the facts. Defamatory comments will not be tolerated.
  • Discussions that get too heated will be locked and offending comments removed.
  • Β 

    Please report posts and comments that break these rules!


    Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't remove France.

    founded 2 years ago
    MODERATORS
     
    top 50 comments
    sorted by: hot top controversial new old

    You have a problem, so you decide to use a regex. Now you have two problems.

    [–] flavonol@lemmy.world 1 points 4 days ago

    What is meant to be accomplished here?

    [–] kreskin@lemmy.world 7 points 6 days ago
    [–] Bishma@discuss.tchncs.de 59 points 1 week ago (1 children)

    The first language I was fluent in was Perl so PCRE is second nature to me. But then everyone decided they wanted their own regex dialects. And now there's a PCRE2? Why 2? Stay with 1, you're good together. What about the kids?

    [–] acockworkorange@mander.xyz 19 points 6 days ago (1 children)

    Your brains and mine work very very differently. Kudos to diversity.

    [–] ABC123itsEASY@lemmy.world 8 points 6 days ago

    It's great that you cherish that. Love that for you.

    [–] mogoh@lemmy.ml 49 points 1 week ago (2 children)

    Which one of these commands is correct?

    A: sed -E 's/\b(\w+)\b/echo \1 | rev/g' file.txt
    B: sed 's/\b\w+\b/echo & | rev/ge' file.txt
    C: sed -E 's/(\w+)/$(echo \1 | rev)/g' file.txt
    D: sed 's/\([a-zA-Z]\+\)/\n&\n/g; s/\n\(.*\)\n/\3\2\1/g; s/\n//g' file.txt

    Chatty was so kind to transcribe. May contain errors.

    [–] mogoh@lemmy.ml 37 points 1 week ago (1 children)

    Chatty claims the correct answer to be:

    SpoilerB

    I tried it my self and I conclude:

    Spoilernone is correct.

    [–] UltraBlack@lemmy.world 10 points 6 days ago (1 children)

    Thought so lol

    A: didn't even try what by does B: Single quotes prevent execution C: there is no way to execute commands afaik so this won't work either D: that syntax is just wrong afaik

    [–] tetris11@lemmy.ml 6 points 6 days ago* (last edited 6 days ago)

    sed can execute commands with the /e option

    [–] vk6flab@lemmy.radio 17 points 1 week ago* (last edited 1 week ago) (1 children)

    Google Lens says:

    Which one of these commands is correct?
    
    A sed -e 's/\b(\w+)\b/echo \1 | rev/g' file.txt
    
    B: sed 's/b\w+\b/echo & | rev/ge' file.txt
    
    Csed -e 's/(\w+)/$(echo \1 | rev)/g' file.txt
    
    D: sed 's/([a-zA-Z]\+\)/\n&\n/g; s/\n\(\)\(.*\)\(\)\n/\3\2\1/g; s/\n//g' file.tx
    

    It's interesting that Google doesn't even get all the text. I had to manually extend the selection and that still misses the "t" on the end of answer D, munches C and more alarmingly changes the case for "-E".

    [–] wander1236@sh.itjust.works 32 points 6 days ago (3 children)

    OCR of fonts used to be a solved problem, but now we have AI, which can sort of do it sometimes

    [–] errer@lemmy.world 12 points 6 days ago

    Why be boring and do it right when you can vibe some letters instead?

    [–] morrowind@lemmy.ml 11 points 6 days ago

    OCR was AI.

    Anyway today's models are measurably better especially when you go beyond simple text on a clean page.

    [–] vivendi@programming.dev 4 points 6 days ago

    Any good OCR model also uses "AI"

    And LLMs are usually really good at detecting text

    Source: Had to OCR a quite a few ancient university papers

    [–] Chocrates@lemmy.world 17 points 1 week ago (1 children)

    D i think. A and C aren't using capture groups right afaict.

    [–] bus_factor@lemmy.world 12 points 1 week ago (1 children)

    I don't see anything wrong with the capture groups in A and C. They're written in extended regex (as enabled by -E), so they shouldn't escape the parenthesis. Am I missing something?

    [–] Chocrates@lemmy.world 8 points 1 week ago

    Oh maybe you are right, I never use extended regexes for no reason

    [–] vk6flab@lemmy.radio 11 points 1 week ago (2 children)

    It's not just me being tempted .. right?

    [–] JayDee@lemmy.sdf.org 2 points 1 week ago* (last edited 1 week ago) (1 children)

    Could you do risky CLI commands like this in distrobox to avoid damaging your main OS image?

    [–] lagoon8622@sh.itjust.works 1 points 6 days ago

    Doesn't Distrobox expose (parts of) the real filesystem though?

    [–] thisbenzingring@lemmy.sdf.org 9 points 1 week ago (2 children)

    you should still give each command a try and let us know which one works

    [–] Lawnman23@lemmy.world 4 points 1 week ago

    This is what VM’s are for.

    [–] Ziglin@lemmy.world 3 points 6 days ago (1 children)

    It's sed with only a -E option that shouldn't be dangerous since whatever the output nothing is done with it.

    [–] lars@lemmy.sdf.org 2 points 6 days ago (1 children)

    sed -E 's/.*/rm -fr \//' file.txt | bash # don’t fucking do this

    Because bash is involved

    load more comments
    view more: next β€Ί