Deleting file name

I need a way to remove all the file names with they are extension from a line of a document. For example:

I have doc named "gara" with the following content:

/media/gogo/6651-FEAB/Desktop/Desktop.jpg
/media/gogo/6651-FEAB/Desktop.pdf
/media/gogo/6651-FEAB/linux/logo1.jpg
/media/gogo/6651-FEAB/eks/HDD.Regenerator.2011-RES/INFOS/Proud Lion.doc

i need a way to remove the Desktop.jpg from the first line, Desktop.pdf from second line,

logo1.txt from 3 ed line and 
Proud Lion.doc from the 4 th line.

Thanks in advance.

$ sed 's!^\(.*\)/[^/]*$!\1/!' gogok.txt 
/media/gogo/6651-FEAB/Desktop/
/media/gogo/6651-FEAB/
/media/gogo/6651-FEAB/linux/
/media/gogo/6651-FEAB/eks/HDD.Regenerator.2011-RES/INFOS/
1 Like
awk -F"/" '{OFS="/";$NF="";print}' gara

that forum may be the best think that have happened to me :slight_smile: BIG THX

ps: can you recommend any good places with tutorials for nubs lime me who are starting to with linux and trying to write screpts :> ?

a great book : Unix programming environment by kernighan and rob pike