'awk'에 해당하는 글 1건


To see the result of an evaluation at every experiment, it is common to access a last modified directory.

I used to do 'ls -altr' , copy the last field in last line with my mouse dragging and then paste something like "cd <pasted directory name>" 


$NF within AWK program refers to the number of fields of the current record, thus printing $NF means the last field in the record.


By using this


$ function cdl(){
        cd `ls -altr|grep -i ^d|awk '{print $NF}'|grep -i '^[[:alpha:]]'|tail -n 1`
}


then i can access the last modified directory with 'cdl' command.



Tag : 리눅스, 마지막필드, awk, 디렉토리


WRITTEN BY
RootFriend
개인적으로... 나쁜 기억력에 도움되라고 만들게되었습니다.

,