Help me with shell script command to print

I have a file with similar line like below

/u13/orabkup/u13/orabkup/abcd/arc82.123

Now I need to have only u13/orabkup/abcd/arc82.123 rather than /u13/orabkup/u13/orabkup/abcd/arc82.123

Kindly help me to print /u13/orabkup/ only once and the file name abcd/arc82.123..

Thanks & Regards
Anitha

Hey!!!

Please use code tags for data samples and codes.

Try sth like,

sed -i.bak 's/\(\/[^/]*\/[^/]*\)\1/\1/g' file_name

Here this command will work for your requirement like below.

/ori_string1/ori_string2/dup_str1/dup_str2/other_str/
 
Ouput will be,
 
/ori_string1/ori_string2/other_str/

Cheers!!
-R