getting rid of absolute path while zipping files in unix
Posted: Tue Mar 27, 2012 9:54 am
Hi I am using below unix command to zip the reject files in DirReject directory which have record (line) count >1, It works fine but the files are having their absolute path along with them, Can you please help me get rid of the absolute path and have just file name.
zip DirReject/Rejects_zip `wc -l DirReject/*.Rej| awk '$1>1{print}'|awk '$2 !~ /total$/'| awk '{print $2}'`
files in my Rejects_zip file are : /home/dir1/dir2/xxx1.Rej
/home/dir1/dir2/xxx2.Rej
But I would like to see : xxx1.Rej
xxx2.Rej
Thanks a lot in advance!!
-reedy
zip DirReject/Rejects_zip `wc -l DirReject/*.Rej| awk '$1>1{print}'|awk '$2 !~ /total$/'| awk '{print $2}'`
files in my Rejects_zip file are : /home/dir1/dir2/xxx1.Rej
/home/dir1/dir2/xxx2.Rej
But I would like to see : xxx1.Rej
xxx2.Rej
Thanks a lot in advance!!
-reedy