Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete last argument in file 1

Status
Not open for further replies.

UsRb

IS-IT--Management
Mar 19, 2007
48
HR
Hi2all

I have listed content of backup directory in file popis.log by date (ls -lt). Now I want that script automatically deletes the oldest directory in popis.log (just one because backup directory fills with one directory every day). How can I specify deletion of last argument in popis.log?

Thx in advance...
 
A starting point:
rm -r `awk '{d=$NF}END{print d}' popis.log`

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
That was quick, and helpful too! Thx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top