Here the [^/]*\/ referees to the files that do not contain any back slashes which eliminates the possibility of finding files in the current directory.
Did Sugar mean slashes and not backslashes?
Isn’t that backslash in there to escape the slash?
Sidenote: I’m easily annoyed I guess, but it bugs me when you hear a commercial on the radio and they read out a link for more information at the end saying “backslash”. OMG, it’s a forward slash. Just say “slash”. UGH.
The original post I made was asking if the author of the article mistakenly typed “back slashes” in the description of the regex. I think he meant forward slashes. Not sure why you wouldn’t just say slashes. There wouldn’t be any back slashes in a find for the current directory or any subdirectories and that’s not what the regex is doing anyway.
Welcome to the world of infinite frustration. “Non-technical” society has spoken loud and clear: They have no interest in learning how to differentiate between a forward and a backward slash.
Hell, plenty of them can’t tell a colon from a semicolon.
Some even regularly confuse double and single quotes. (Doesn’t help that, while C/C++ treat the two very differently, most other languages let you use them (in pairs) interchangeably. So even coders who aren’t C/C++ coders see it [correctly, to an extent] as, “Eh, what’s the difference?”)
It’s a curse, being a precisionist in an imprecise world.
On that point, I have to disagree. Since the pattern string itself contains both forward and backward slashes, my response to someone “just saying slashes” would be: “Which ones?”
(Unless they were discussing both the forward and backward slashes, and referred to the “slashes” as opposed to the “backslashes”, so that it’s clear they mean forward slashes in those cases.)
Finally, one thing I try to impress upon people who are clearly never going to sort out the whole forward/backward slash thing: They can just call them “directory slashes”, which has the added advantage that it translates to forward slashes on Linux/macOS and backslashes on Windows, so they don’t have to keep them straight in their clearly porous brains. (Just… don’t use it when talking about URLs.)
Aside from IT, what sincerely drives me nuts is, when people use equal sounding words interchangeably, even though their meaning (semantics) may be very different.
Du sollst Opa umfahren! = You should drive around grandpa.
Du sollst Opa umfahren! = You should drive over grandpa.
Most of the times, though, it should be clear from context what is meant. Unless grandpa has been transformed into a zombie or a vampire, driving him over, shouldn’t be an option.
In latin (Noli me tangere) the emphasis is usually on the first word.
When you translate that to English, it is not at all clear to the reader where the emphasis is. Things are lost in translation.
I have no idea what the original (Hebrew) meant.
Heh. That was actually a line (“welcome to…”) that someone whipped out on me over @ one of the ex-Gawker sites, after I left a Quixotic comment regarding… some article transgression that’s becoming so common, trying to point them out is basically spitting into a hurricane.
(Might’ve been a “literally” that preceded a clearly figurative statement. Because, if you ask 10 people to define “literal”, 8 of them will get it wrong. Yet, I guarantee ALL 10 of them are still using it all the fucking time.)
I forget what journalist’s/editor’s rule was, “If you can’t give me the definition of the word, you don’t get to use it in the article.” But can we get those people back?
(Aside: Why does “yore” never get any love, when discussing homonym confusion? )
I’m belatedly arriving at the realization that speech-to-text transcription is… not exclusively to blame for that, but is a much bigger contributor than I’d initially realized. Mostly because I hadn’t realized just how many, and how heavily, people rely on text-to-speech speech-to-text nowadays. (I’ve always personally held the belief that the two biggest evils in computing are talking computers, and talking to computers. My only conundrum is deciding which is worse.)
But over time, I’ve gotten better and better at spotting the distinctive type of homonym errors that are almost certainly the fault of voice transcription: “disgust” showing up in place of “discussed”, or “through”/“threw” swaps… errors that are far less likely the fault of a human than of software. And the really surprising thing (to me) is both the frequency, and the diversity of contexts, with/in which I’ll end up spotting those “tells”.
…Not that that’s any excuse. The way I see it, if you have a machine transcribe your words then you have a responsibility to proofread its work and you should fix any errors the software made. But we’ve come full circle on the original premise here: “should” doesn’t count for shit. The majority of people just DGAF and never will.
Was just trying to use perl rename to replace a “.” (the first one found only) with " -" (space and hyphen) :
╭─x@titan ~/MPZ/YOUNG-Neil/1970-AfterTheGoldRush-FLAC
╰─➤ ls -al
total 206981
drwxr-xr-x 2 x family 16 Mar 1 2016 .
drwxr-xr-x 28 x family 29 May 15 10:45 ..
-rwxrwxrwx 1 x family 18022493 Mar 1 2016 '01. Tell Me Why - Neil Young.flac'
-rwxrwxrwx 1 x family 20137561 Mar 1 2016 '02. After The Gold Rush - Neil Young.flac'
...
-rwxrwxrwx 1 x family 9130074 Mar 1 2016 '11. Cripple Creek Ferry - Neil Young.flac'
...
So :
╭─x@titan ~/MPZ/YOUNG-Neil/1970-AfterTheGoldRush-FLAC
╰─➤ rename 's/\./\ -//' * 255 ↵
syntax error at line 2, at EOF, in:
s/\./\ -//
And I couldn’t figure out why it wasn’t working… What’s wrong with my regex?
Googled it - came to a StackOverflow article, where someone suggested using “#” instead of forward slash - and it worked! :
╭─x@titan ~/MPZ/YOUNG-Neil/1970-AfterTheGoldRush-FLAC
╰─➤ ls -al
total 206981
drwxr-xr-x 2 x family 16 May 15 10:49 .
drwxr-xr-x 28 x family 29 May 15 10:45 ..
-rwxrwxrwx 1 x family 18022493 Mar 1 2016 '01 - Tell Me Why - Neil Young.flac'
-rwxrwxrwx 1 x family 20137561 Mar 1 2016 '02 - After The Gold Rush - Neil Young.flac'
...
-rwxrwxrwx 1 x family 9130074 Mar 1 2016 '11 - Cripple Creek Ferry - Neil Young.flac'
...
Maybe I only needed to terminate the first regex with a single ‘/’ ? : rename 's/./\ -/' *
Just tested it - and yeah - single “/” at the end… Doh!
It’s only double slash to remove the offending character (instead of replacing it) like :
rename 's/\.//' *
But why did it work when I used two “#” terminating my regex?
I dont know about rename, but in vi I have always used :s/string/replacement/
for a single case, and :g/string/s//replacement/g
for multiple occurences
In vi I’ve always used : :%s/string/replacement/
(for first occurrence)
and :%s/string/replacement/g
(for all occurrences)
Not even sure why / how - just been doing that ~25 years or so… i.e. mostly from muscle memory - don’t even think about it…
When using “sed” style regex with the rename (perl rename or “prename”) command - I’m mostly removing spaces from filenames - I prefer CamelCase (but the amount of regex required for that is WAY beyond my skillset!) - so when I’m replacing space - it’s :
's/\ //'
that simple - and I guess I just finished my
's/\./\ -//' because I’m more used to using it to remove space chars from file / dir names… it should have been 's/\./\ -/' or 's/\./\ -/g' - but I wouldn’t want the “g” 'cause then it would remove the dot before the filename extension too!