The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 05-14-2008
era era is online now
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,063
Are we talking Perl or grep or something else here? There are many different regex flavors and the matching strategy would also depend on what infrastructure is available in the tool.

For Perl, something like m%/(\d{4}/\d{1,2}/\d{1,2})/\d+/([^/]+)/([^/]+)$% would get the substrings you request into $3, $2, and $1, respectively.

Last edited by era; 05-14-2008 at 11:58 AM. Reason: Add m%...% wrapper
Reply With Quote