Hi all
If I have lines in a file as follows :-
/ora04/oradata/data1/data1.dbf
/ora01/app/product/8.1.6/dbs/F1.Dbf
/ora04/oradata/data2.dbf
How can I select the last part of the line as my file name. Can I start from the right and define "/" as my delimeter ?
Thx
J
echo '/a/b/c/d' | sed 's#.*/\(.*\)#\1#'
Puuurfect !!!!!!!!!
Thank you
One last question on this. How do I capture the rest of the line from the position where field 1 ends.
e.g.
Field1=`echo '/a/b/c/d' | sed 's#.*/\(.*\)#\1#'`
Restof= ?
output
Field1=d
Restof=/a/b/c/
Thx
J
RestOf=`echo '/a/b/c/d' | sed 's#\(.*\)/.*#\1#'`
you might consider looking into dirname/basename