Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by LanX (Sage)
on Jul 07, 2022 at 13:44 UTC ( #11145328=note: print w/replies, xml ) Need Help??


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

>
$datum =~ s/ /[\\;:,-]/g; system("ls -1 $datum");'

I have no linux to test at hand, but does ls really support regex-character classes?

the -1 option doesn't seem to activate this https://www.man7.org/linux/man-pages/man1/ls.1.html

and I'm confused why ls should support something above globbing ...

plz enlighten me! :)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^5: How to replace spaces with different chars?
by hippo (Bishop) on Jul 07, 2022 at 13:48 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.


    🦛

Re^5: How to replace spaces with different chars?
by kcott (Archbishop) on Jul 07, 2022 at 14:19 UTC

    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://11145328]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2022-12-05 13:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?