Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

by LanX (Saint)
on Jul 07, 2022 at 13:44 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-25 19:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found