help with cut command
Hello All,
I need help to change the path using cut. I tried lot of things, bit no luck. Path = /a/b/c/d/e/f/g/ Output = /a/b/c/d/e/f I want output as shown above. Please help Thanks. |
Besides wanting to cut part of it off, are you looking to strip the last directory, and that's it? If so, you can simply use sed for this:
Code:
echo "/a/b/c/d/e/f/g/" | sed 's/.\{3\}$//' Cheers, Josh |
'man cut': the "-d" and "-f" args or even simpler: VAR="/a/r/g/s"; dirname $VAR
|
If the path is stored in a shell variable,then simple parameter substitution is all you need:
Code:
$ path='/a/b/c/d/e/f/g/' |
(deleted)
' dirname ' was already refered by unSpawn :/ |
thanks so much , there are so may ways .. din't knew that. all worked.
|
All times are GMT -5. The time now is 12:34 PM. |