add apostrophes with regular expression in perl -


I'm searching the directory with command ls -ld /path1/*.ext1 / path2 / *. Ext2 , e.t.c.

Sometimes, files have special characters in the name: ) , (, etc.).

For this reason, I want to add aproprows in every search directory.

For example:

  $ filter = "ls -ld / Path1 / * ext1 / path2 / * ext2 "; (1) $ filter = ~ ...; (2)   

After the regular expression is applied, the result should be:

  ls -ld '/ path1 / * ext1' '/ path2 / * ext2' (with apostrophes)   

What is a regular expression (2)

    

$ Filter = ~ s! (\ S +)! '$ 1'! G;

Better way to do this:

  while (globe ("/ path1 / * ext1 / path2 / * ext2") {process_file ($ _);}   

Regards,

Comments

Popular posts from this blog

c# - passing input text from view to contoller with FacebookContext using Facebook app -

ios - Does Core Data autoupdate a many to many relationship on saving -

Calling a C++ function from C# by passing a string with variable size to it -