On Fri, Nov 28, 2014 at 1:08 PM, Baskar Selvaraj <bas...@linuxpert.in> wrote:
>>>   $ 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='/'
>
> Ok now.
>
> subject=$(echo $PWD | awk '{print $(NF - 1), $NF}' FS='/' OFS='/')
>

Been away from the list for a while.

FWIW, command dirname will return the directory portion of a full
pathname, basename returns the last part of a full pathname.

-- Arun Khan
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
ILUGC Mailing List Guidelines:
http://ilugc.in/mailinglist-guidelines

Reply via email to