[NTLUG:Discuss] scripting question
Robert Citek
robert.citek at gmail.com
Wed Apr 20 14:23:41 CDT 2011
On Wed, Apr 20, 2011 at 3:06 PM, Fred James <fredjame at fredjame.cnc.net> wrote:
> Monty Shinn wrote:
>> I am trying to delete part of a line that is actually a directory path in
>> a file with multiple lines.
> Monty Shinn
> Did you "escape" (\) the special characters (in this case the /)?
> s/\/usr\/test\/working\///
With sed, escaping will work. Also, using a different delimiter, e.g.
#, will work:
$ echo "
/usr/test/working/access/hbr/filename.plist.
/usr/test/working/access/mbr/filename.plist.
/usr/test/working/access/lbr/filename.plist.
" | sed -e 's#/usr/test/working/##'
cut will also work:
$ echo "
/usr/test/working/access/hbr/filename.plist.
/usr/test/working/access/mbr/filename.plist.
/usr/test/working/access/lbr/filename.plist.
" | cut -d/ -f5-
Regards,
- Robert
More information about the Discuss
mailing list