nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Grep and remove files

This is a discussion on Grep and remove files within the Linux software forums, part of the Linux Getting Started category; I'm new and not understanding how to grep and remove files. For example I have two different situations A) Remove ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Linux software

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 01-05-2006, 07:01 PM
Guest
 
Posts: n/a
Default Grep and remove files

I'm new and not understanding how to grep and remove files. For example I have two different situations

A) Remove all files matching criteria, file name start with digits only

B) Second is I have name of all files in file called track.log. how to grep and remove

Sample track.log file
/home/app/trackv2/0104zle.log
/home/app/trackv2/idem44.log
/home/app/trackv2/idem224.log
/home/app/trackv2/0104zyt.log
/home/app/trackv2/0104gbw.log


So on?

Sorry for my poor english.. plz some1 helpme
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-05-2006, 07:25 PM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 581
Rep Power: 7
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
Default

Quote:
A) Remove all files matching criteria, file name start with digits only
Code:
ls | grep -E "^[0-9]" | xargs rm
B) Second is I have name of all files in file called track.log. how to grep and remove

Code:
grep -E "/[0-9]" track.log | xargs rm
It all depends upon your grep filter, if you need more help feel free to reply
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Uninstall remove yum packages zafar466 Linux software 5 01-19-2008 10:38 PM
How to remove grub vista? raj Windows Xp/2000/2003 server administration 1 10-08-2007 02:02 AM
Grep ip address in Linux or UNIX sweta Getting started tutorials 0 07-27-2007 07:47 AM
linux password remove Linux software 1 01-18-2006 08:43 PM
Script to remove executable files sweta Shell scripting 4 03-12-2005 02:21 PM


All times are GMT +5.5. The time now is 08:44 PM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36