String replace

I have a 100 liners in a file and every line looks like
line 1
AB://abcd.01/ABCDE/ABC.Monitor/tags/Release_0.39.16.200/db/ABC/01-DML.sql
line 2
BC://abcd.01/ABCDE/ABC.Monitor/tags/Release_0.39.16.200/db/ABC/02-DML.sql

How do i cut the characters from Release_0.39.16.200/db/ABC/ in a shell.
I try to use field seperator in awk some how does not give me the way i want.
Please help ..

Do your lines have a fixed length ?
if yes you can use

cut -c ...

otherwise

read a
b=${a#*//*/*/*/*/} 
echo ${b%/*}/
# a="BC://abcd.01/ABCDE/ABC.Monitor/tags/Release_0.39.16.200/db/ABC/02-DML.sql"
# echo $a
BC://abcd.01/ABCDE/ABC.Monitor/tags/Release_0.39.16.200/db/ABC/02-DML.sql
# b=${a#*//*/*/*/*/}
# echo ${b%/*}/
Release_0.39.16.200/db/ABC/

Is it this you are looking for?

$ awk -F/ '{print $7,$8,$9FS}' OFS=/ file
Release_0.39.16.200/db/ABC/
Release_0.39.16.200/db/ABC/

Or if you need the trailing / you can do it with awk also :

awk -F/ '{print $7,$8,$9,x}' OFS=/ infile
Release_0.39.16.200/db/ABC/
Release_0.39.16.200/db/ABC/

I forgot the last slash, thanks ctsgnb :wink:

no pb dude :smiley:

Thankyou every one for your great help..

use cut directly.

cut -d \/ -f7- < infile

almost ... you need to get rid off the trailing [^/]*.sql chain