recentpopularlog in

therobyouknow : regularexpression   3

How to extract a directory and filename from a path in a string, Perl Regular Expressions - Kewl Splitpath One Liner Regex
Kewl Splitpath One Liner Regex

Check out this splitpath command:
my($text) = "/etc/sysconfig/network-scripts/ifcfg-eth0";
my($directory, $filename) = $text =~ m/(.*\/)(.*)$/;
print "D=$directory, F=$filename\n";
regular  regexp  regex  expression  regularexpression  match  matching  howto  programming  software  reference  development  perl  linux  tutorial  search  code  computing  coding  scripting  tip  path  directory  find  extract  filename  parse 
january 2010 by therobyouknow

Copy this bookmark:





to read