ls & rm with regular expression

e.g. rm -rf backup-20070[8-9]-*

would delete :

  • backup-200708-morning
  • backup-200708-evening
  • backup-200709-night
  • backup-200709-latenight

but not :

  • backup-200706-morning
  • backup-200707-afternoon
  • backup-200711-midnight

e.g. ls backup-20070[1-9] would list all backup starting from January to September but leave October, November & December out, of year 2007.

Related posts:

  1. Regular Expression Cheat Sheet for you out there always trying to grep, ls, vi...
  2. useful unix command: xargs In our mailserver, we backup every incoming email and keep...
  3. How to dig SRV record after creating it in DNS dig <record type> <host.name> e.g dig SRV _someservice._port.hostname.domainame.com.my OR dig...
  4. FreeBSD New Web Interface Wow.. FreeBSD new interface layout is clean and nice. The...
  5. split – but no destination parameter to specify first : cd /destination/directory second : split /source/directory/big-huge-file prefix-to-apply-onto-splited-files Voila...
  6. convert epoch using date command date -d ‘<Unix epoch> <epoch date> sec’ e.g. date -d...
  7. Servers Uptime. More Than 356 days, 1 Year Old Phew, time flies… I’ve been working with AIMS for more...
  8. Maxis Online billing … gone Maxis online billing out of service. ...
  9. Oracle ...
  10. How to Install FreeBSD 5.4 on Your Machine FreeBSD is an advanced operating system for x86 compatible (including...

Leave a Reply