replace points and slashes
am 16.11.2004 14:52:38 von Guenther Kober
Hi!
I'm searching the WWWeb for an answer but without success:
i have a csv-file where the lines look like:
.../MKA/In/h3g_20041104_delta.csv,D,1234567890,-1,-1,8602,86 01,20041106,0,0,I
n
Now i have to remove the path of the file, but not complete.
It should look like this:
MKA,h3g_20041104_delta.csv,D,1234567890,-1,-1,8602,8601,2004 1106,0,0,In
But I have troubles with the replacement of "../" or just the "/".
I tried sed and tr.
Any help is welcome! :-)
-gue-
Re: replace points and slashes
am 16.11.2004 15:02:14 von Stephane CHAZELAS
2004-11-16, 14:52(+01), Guenther Kober:
[...]
> i have a csv-file where the lines look like:
> ../MKA/In/h3g_20041104_delta.csv,D,1234567890,-1,-1,8602,860 1,20041106,0,0,I
> n
>
> Now i have to remove the path of the file, but not complete.
> It should look like this:
> MKA,h3g_20041104_delta.csv,D,1234567890,-1,-1,8602,8601,2004 1106,0,0,In
>
> But I have troubles with the replacement of "../" or just the "/".
[...]
sed 's|^\.\./\([^/,]*\)[^,]*/|\1,|'
--
Stephane
Re: replace points and slashes
am 16.11.2004 15:07:11 von Guenther Kober
"Stephane CHAZELAS" wrote in message
news:slrncpk236.nh6.stephane.chazelas@spam.is.invalid...
>
> sed 's|^\.\./\([^/,]*\)[^,]*/|\1,|'
>
hardcore - but it works!
thanks a lot,
-gue-