can't get non-greedy matching to work in sed
I want to do something like:
Code:
echo "/1_one/2_two/3_three.xyz" | sed 's/[/].*$/$$$/' Code:
sed 's/[/].*?$/$$$/' How can I do this (with sed)? Thanks. |
Is that an answer :
echo $(dirname "/1_one/2_two/3_three.xyz")'/$$$' |
With sed:-
Code:
echo "/1_one/2_two/3_three.xyz" | sed 's|\(/.*/\).*|\1$$$|' |
And another sed-version :}
Code:
echo "/1_one/2_two/3_three.xyz" | sed -r 's|(/.+/)[^/]+$|\1$$$|' |
All times are GMT -5. The time now is 07:25 PM. |