- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- deleting files
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-03-2010 10:40 PM
тАО02-03-2010 10:40 PM
I want to delete the output of this command which is a very big list:
$ls -lrt|grep 'Jan 23'|grep gz
How to delete it ?
Thanks,
Shiv
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-03-2010 11:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-03-2010 11:21 PM
тАО02-03-2010 11:21 PM
Re: deleting files
verify the targeted files
$ls -lrt |grep "Jan 23" |grep ".gz" |awk '{print $9}'|xargs -i -l echo {}
once verified
$ls -lrt |grep "Jan 23" |grep ".gz" |awk '{print $9}'|xargs -i -l rm {}
there are many alternate methods ..thought to modify the command you used for listing files
Johnson
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-03-2010 11:22 PM
тАО02-03-2010 11:22 PM
Re: deleting files
$ls -lrt | grep 'Jan 23' | grep gz > /tmp/abc
for I in `cat /tmp/abc`
do
rm $I
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-03-2010 11:23 PM
тАО02-03-2010 11:23 PM
Re: deleting files
List before you delete.
=======================
find /folder_name -name "*.gz" -mtime +7 -exec ll {} \;
Remove files after confirmed
============================
find /folder_name -name "*.gz" -mtime +7 -exec rm {} \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-03-2010 11:35 PM
тАО02-03-2010 11:35 PM
Re: deleting files
for I in `cat /tmp/abc`
do
rm $I
done
It will remove all the zipped file of Jan 23 from the current folder.
Tech Mahindra
Data Canter Tubli Bahrain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-03-2010 11:42 PM
тАО02-03-2010 11:42 PM
Re: deleting files
R.K & Tarun>>
$ls -lrt | grep 'Jan 23' | grep gz > /tmp/abc
for I in `cat /tmp/abc`
do
rm $I
done
ls -lrt command output have 9 fields , in order to delete you need to extract the file name from ls -lrt out put
comand should be
ls -lrt | grep 'Jan 23' | grep gz |awk '{print $9}' >/tmp/abc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-04-2010 12:43 AM
тАО02-04-2010 12:43 AM
Re: deleting files
$ls | grep 'Jan 23' | grep gz > /tmp/abc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-04-2010 01:09 AM
тАО02-04-2010 01:09 AM
Re: deleting files
$ls | grep 'Jan 23' | grep gz > /tmp/abc
again ls wont display time stamp and grep with "Jan 23" wont have any effect on the out put
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-04-2010 01:49 AM
тАО02-04-2010 01:49 AM