[NTLUG:Discuss] scripting question

Fred James fredjame at fredjame.cnc.net
Wed Apr 20 14:06:26 CDT 2011


Monty Shinn wrote:
> Greetings.
>
> I am trying to delete part of a line that is actually a directory path 
> in a file with multiple lines.
>
> The paths in the file looks like this:
>
> /usr/test/working/access/hbr/filename.plist.
> /usr/test/working/access/mbr/filename.plist.
> /usr/test/working/access/lbr/filename.plist.
>
> I am wanting the paths in the file to end up like this:
>
> access/hbr/filename.plist
> access/mbr/filename.plist
> access/lbr/filename.plist
>
> I have monkeyed around with sed to no avail.  Can't seem to get it to 
> match the pattern I want it to.  I was able to get grep to see the 
> pattern using grep -E, but can't figure out how to do anything with 
> the output.
>
> I am trying to do this inside a bash script.
>
> Google is just confusing me all the more...
>
> Any help would be greatly appreciated.
>
> Thanks,
>
> Monty
Monty Shinn
Did you "escape" (\) the special characters (in this case the /)?
    s/\/usr\/test\/working\///
Regards
Fred James



More information about the Discuss mailing list