unixguy has asked for the wisdom of the Perl Monks concerning the following question:
e.g path name: /home/code/work I want to print like this.
/home /home/code /home/code/work
I tried this one line, didn't print what I wantecho "/home/code/work"|perl -lane 'while(m#([^\/]+)#g) {print "$1";}'
home code work
Can some one help me on this? Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular expression parse pathname
by toolic (Bishop) on Jan 29, 2010 at 01:13 UTC | |
|
Re: Regular expression parse pathname
by jwkrahn (Abbot) on Jan 29, 2010 at 02:49 UTC | |
|
Re: Regular expression parse pathname
by rubasov (Friar) on Jan 29, 2010 at 02:38 UTC | |
|
Re: Regular expression parse pathname
by aquarium (Curate) on Jan 29, 2010 at 02:47 UTC | |
|
Re: Regular expression parse pathname
by JavaFan (Canon) on Jan 29, 2010 at 10:47 UTC | |
|
Re: Regular expression parse pathname
by shawnhcorey (Friar) on Jan 29, 2010 at 14:42 UTC | |
|
Re: Regular expression parse pathname
by hbm (Hermit) on Jan 29, 2010 at 19:46 UTC |