Posted By

noah on 11/08/08


Tagged

http rails commandline rake one-liners


Versions (?)

Rake routes filtering with Perl


 / Published in: Perl
 

URL: http://developer.apple.com/documentation/OpenSource/Conceptual/ShellScripting/RegularExpressionsUnfettered/RegularExpressionsUnfettered.html#//apple_ref/doc/uid/TP40004268-CH238-SW7

  1. rake routes > routes.txt
  2. perl -ne 'm{(.* GET)(.*)}; print qq{$1 $2\n} if $1' routes.txt
  3. perl -ne 'm#(?:GET\s+| {7})(/[^\s]+)#; print qq{$1\n} if $1' routes.txt
  4. perl -ne 'm#^\s+(.*)(GET\s+| {7})(/[^\s:.]+)#; print qq{$1 $2 $3\n} if $2' routes.txt
  5. perl -ne 'm#^\s+(.*)(GET\s+| {7})(/[^\s.]+)#; print qq{$3\n} if $2' routes.txt

Report this snippet  

You need to login to post a comment.