On Fri, Nov 28, 2014 at 12:11 PM, Shakthi Kannan <shakthim...@gmail.com> wrote: > Hi, > Use awk: > > $ echo "/pub/videos/nptel/Computer Science and Engineering/Data Structures > And > Algorithms" | awk '{print $(NF - 1), $NF}' FS='/' OFS='/'
It works, but however I could not store the output in a variable because of long file name in the output. echo $PWD | awk '{print $(NF-1), $NF}' FS='/' OFS='/' S. Baskar _______________________________________________ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc ILUGC Mailing List Guidelines: http://ilugc.in/mailinglist-guidelines