Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: How to replace spaces with different chars?

by kcott (Archbishop)
on Jul 07, 2022 at 13:12 UTC ( [id://11145326]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to replace spaces with different chars?
in thread How to replace spaces with different chars?

++ Well spotted.

If I add fidlee:

$ ls -1 a/b/c/d/e 'f:i-:l;e' 'fi:l;e' 'f-i:l;e' 'f-i-:l;e' fi:le fidlee

I get an additional line in the output:

*** Files matching 'a/b/c/d/e/fi l e': 'a/b/c/d/e/fi:l;e' a/b/c/d/e/fidlee

Changing y/ /?/ to s/ /[\\;:,-]/g fixes this. I've updated my post.

— Ken

Replies are listed 'Best First'.
Re^4: How to replace spaces with different chars?
by LanX (Saint) on Jul 07, 2022 at 13:44 UTC
      does ls really support regex-character classes?

      It isn't ls which supports it, but the shell's globbing. All shell globs support character classes inside square brackets. Well, all Bourne-like shells anyway.


      🦛

      I see ++hippo has provided an answer.

      For full documentation of what's happening, see man bash; follow the EXPANSION link; scroll down (lots) to "Pathname Expansion" for screenfuls of information.

      — Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11145326]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (None)
    As of 2024-04-25 01:43 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found