BWAHAHAHAHOUHAHA-HAHA!
I honestly did not expect ChatGPT to fail so badly! (I will not paste any of its output, Lunduke!)
It's my first time to directly use ChatGPT. I just couldn't come up with anything I want to know that it could reliably tell me. Until today when I realised I keep receiving requests by some relatives to do a bash oneliner for some text files and I'd be offloaded if I could just tell them how to do it themselves in PowerShell but it'll be long before I've learnt what I need so I have the option to ask an RTFM-level-stupid question on StackOverflow or... to test out the great deceiver. So I sacrificed the confidentiality of my name, surname and friggin' phone number to have a go. I'll paste here just my input but you'll be well able to deduce how it went:
^^^^^^^^^^^^^^^
I want to remove duplicate whitespace from a text file on a Windows 10/11 PC. On Linux with bash what I would do is:
$ cat spacious.txt | tr -s [:space:] > compact.txt
What is the easiest way to do the same on Windows without WSL?
What is the simplest PowerShell script which can produce the same result?
^^^^^^^^^^^^^^^
By whitespace I meant not only " ", but also carriage returns. Does '\s' match carriage returns as well as " "? Also, when I have duplicate carriage returns in the spacious.txt, I want to have single carriage returns in the compact.txt and not ' ' as you suggested. Please provide a suggestion taking this into account.
^^^^^^^^^^^^^^^
Sounds better, but now duplicate spaces and tabs, and carriage returns will be replaced with 1 carriage return AND a newline character. What I want is for duplicate [:space:] as defined by POSIX to be replaced with a single instance of the same kind of whitespace - spacebar, tab, return, enter or whatever other kind of whitespace there is. Two tabs should become one tab, two spacebars - one spacebar, two carriage returns - one carriage return and so on. I pointed you to the bash oneliner:
$ cat spacious.txt | tr -s [:space:] > compact.txt
and I know I should not expect you to understand what it does as you are uncapable of understanding anything due to being no more than a glorified pattern-matching algorithm, but please try to reproduce the exact same functionality in the PowerShell script you recommend. Just to be clear, in case you got confused, I didn't just ask you two things - I asked you the same thing in two different ways - first one case-by-case example to guide you and then one bash oneliner that fulfills exactly what I want, no more, no less.
^^^^^^^^^^^^^^^
Was the third and final suggestion I got by ChatGPT correct? It was the exact same as the first suggestion. Though of course the chatbot acted as if it had corrected itself.
And of course if my question had been answered on StackOverflow, ChatGPT's answer would have been correct. But I wouldn't have had to ask it the question as I've done my own research beforehand. Also the chatbot would get merit that does not belong to it.
If the problem is the way I asked, then I have to ask myself: Is programming more tedious, or prompt engineering?
After receiving an Al generated email, the programming legend (known for his work on Go, Plan 9, UNIX, & UTF-8) says, "F**k you people. Raping the planet."
Torvalds on Vizio Ruling: Software Freedom Conservancy Looks Like "a Bunch of Incompetent Aholes"
Regarding a recent ruling, in SFC v. Vizio, Karen Sandler (SFC Director, former GNOME Director), responds to the Linux creator by saying "maybe you didn't read".
Microsoft's Goal: Replace "Every Line of C" with Rust by 2030?
A Microsoft rep made the statement, saying the company would use Al to hit a target of "1 engineer, 1 month, 1 million lines of code". Then quickly went into damage control.
Ads are filling the entirety of the Web -- websites, podcasts, YouTube videos, etc. -- at an increasing rate. Prices for those ad placements are plummeting. Consumers are desperate to use ad-blockers to make the web palatable. Google (and others) are desperate to break and block ad-blockers. All of which results in... more ads and lower pay for creators.
It's a fascinatingly annoying cycle. And there's only one viable way out of it.
After 20 years together (18 years married), I was finally able to get my lovely wife to watch Die Hard. She never had any interest because of how violent it was, but for whatever reason she was open to it this Christmas. I’m happy to report that she loved it! Yippee-ki-yay everyone. I hope you all had a wonderful Christmas, and have a happy New Year.
If you've done 6 impossible things this week, why not round it off with a trip onboard "thE grAvY trAIn" TONIGHT at 21:00 UK! (1pm Pacific/4pm Eastern)
The FOMO of not having a Lifetime Subscription to The Lunduke Journal
Time for some Fun Lunduke Journal Facts of Fact-ly-ness!
The “per-month” cost of a Lifetime Subscription to The Lunduke Journal is an asymptotic line. The longer you have that subscription, the closer it gets to $0.00.
The Lifetime Subscription was first introduced 3 1/2 years ago… and is still going strong.
The price of a Lifetime Subscription is currently discounted to $89. For life. That’s less than 1/3rd the normal price.
The earlier you pick one up, the quicker that asymptotic line begins approaching zero. Which is fun.
We Don’t Have Time Machines
If you think you might ever want a Lifetime Subscription, now is the time.
Imagine missing this discounted priceand missing out on months of, mathematically certain, asymptotic line fun. This is one of those scenarios where Future You (tm) would want to travel back in time to tell Present You (tm) to snag a Lifetime Subscription.
There are some options. For both subscribing and donating. They're all on this page.
Bonus: At the bottom of this page you will find the invite link to the super-secret Lunduke Journal Discord Chat Server. This is only available for full subscribers, which makes it a nice place to hang out. No riff-raff.
Only for Supporters
To read the rest of this article and access other paid content, you must be a supporter