[Ilugc] [HELP] Extracting directory names using sed

  • From: baskar@xxxxxxxxxxxx (Baskar Selvaraj)
  • Date: Fri, 28 Nov 2014 13:51:11 +0530


Ok now.

subject=$(echo $PWD | awk '{print $(NF - 1), $NF}' FS='/' OFS='/')

No idea with awk, sorry for troubling again.

Now, I want only the previous directory, leaving out the last directory.

/pub/videos/nptel/Computer Science and Engineering/Data Structures And
Algorithms

to

Computer Science and Engineering

S. Baskar

Other related posts: