I want to split this line
/home/edwprod/abortive_visit/bin/abortive_proc_call.ksh
to
/edwprod/abortive_visit/bin/abortive_proc_call.ksh
Can I use sed or awk command for this?
I want to split this line
/home/edwprod/abortive_visit/bin/abortive_proc_call.ksh
to
/edwprod/abortive_visit/bin/abortive_proc_call.ksh
Can I use sed or awk command for this?
echo '/home/edwprod/abortive_visit/bin/abortive_proc_call.ksh' | sed 's@^/[^/]\+@@'
Explanatory words: using sed's replace function, we redefine the separator, which is commonly /
, to @
, saving us the escaping of slashes within the string. We anchor the regex at the beginning of line ^
, and replace the first slash, followed by any non-slash, with nothing, thus removing the first element of the path (not the root, btw).
you don't need awk or sed , just try this
echo -n "/"; echo "/home/edwprod/abortive_visit/bin/abortive_proc_call.ksh" |cut -f3-6 -d/