Please advise on how to remove the first directory from a path by sed,(the inverse pf what basename does).For exampleecho /mnt/VPfig/Amer/AR4/Celtel/files/COM.txt | sed ...I should get:/VPfig/Amer/AR4/Celtel/files/COM.txt
sed + remove the first directory from path
shell script;sed;filenames
Try:echo /mnt/VPfig/Amer/AR4/Celtel/files/COM.txt | sed 's|^/[^/]*||'which gave me:/VPfig/Amer/AR4/Celtel/files/COM.txtIt looks for the first / followed by as many non-/s as possible, then replaces them with an empty string.