a27wang
1
Hi,
i want to remove a certain pattern when i type pwd.
pwd will look like this:
..../....../....../Pat_logs/..../....../...../......
the dotted lines are just random directory names,
i want it to remove the "Pat_logs/...../....../....../" part
so for example:
a/b/c/d/Pat_logs/e/f/g
will become:
a/b/c/d/g
thanks!
---------- Post updated at 12:11 PM ---------- Previous update was at 11:57 AM ----------
I got this... but apparently it does nothing, so I don't think it finds the pattern correctly.
pwd | sed 's/\/PAT_logs\/\(\([:alnum:]+\)\/+\)//'
Scott
2
Hi.
PAT_logs
is not the same as Pat_logs
. Sed like most everything in Unix is case-sensitive.
$ echo a/b/c/d/Pat_logs/e/f/g | sed 's/\/*Pat_logs.*\//\//'
a/b/c/d/g
a27wang
3
Yes, everything should be PAT_logs, I just typed the post in the wrong case sorry.
pwd | sed 's/\\PAT_logs//'
Scott
5
Did you actually test that?
$ echo a/b/c/d/PAT_logs/e/f/g | sed 's/\\PAT_logs//g'
a/b/c/d/PAT_logs/e/f/g
a27wang
6
oops.. I'm trying to close this thread but don't know how