![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Protecting the directory tree | rooneyl | UNIX for Dummies Questions & Answers | 2 | 02-17-2008 05:59 PM |
| Searching directory tree | blane | Shell Programming and Scripting | 7 | 05-29-2007 07:30 PM |
| directory as tree | anything2 | High Level Programming | 2 | 03-01-2007 09:38 AM |
| Space Used by Directory Tree | johnk99 | Filesystems, Disks and Memory | 1 | 07-22-2002 12:30 PM |
| Directory tree search??? | solvman | High Level Programming | 3 | 09-28-2001 01:27 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
directory tree
Hi all,
The following is a script for displaying directory tree. D=${1:-`pwd`} (cd $D; pwd) find $D -type d -print | sort | sed -e "s,^$D,,"\ -e "/^$/d"\ -e "s,[^/]*/\([^/]*\)$,\:-----\1,"\ -e "s,[^/]*/,: ,g" | more exit 0 I am trying to understand the above script.But i am not able to understand the following 2 lines -e "s,[^/]*/\([^/]*\)$,\:-----\1,"\ -e "s,[^/]*/,: ,g" | more can any body pls tell me how the above two lines works. cheers RRK |
|
||||
|
these are sed syntex of find and replace...with regular expressions..
in first line- its searching for "/" in the begining of line for any occurance of "/". [ shown by "*"] escaped paranthesis are used to tell how many occurance.. $ used to find @ the end of every line.. \1,\2 etc used to tell where to find... |
![]() |
| Bookmarks |
| Tags |
| regex, regular expressions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|