getting rid of absolute path while zipping files in unix

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
mekrreddy
Participant
Posts: 88
Joined: Wed Oct 08, 2008 11:12 am

getting rid of absolute path while zipping files in unix

Post by mekrreddy »

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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

First cd to the directory in question, then zip. In other words, zip using a relative path.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply