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. Workflow with Automator … I have always use my mac for surfing, emailing, messaging...
  3. useful unix command: xargs In our mailserver, we backup every incoming email and keep...
  4. Install MySQL5 on Mac OSX With Darwin Port Before installing MySQL5, please be sure you have Darwin Port...
  5. postgresql82-server compile error on Apple Leopard with Macports 1.5 I wasn’t able to compile postgresql82-server on my machine, it’s...
  6. How to Install FreeBSD 5.4 on Your Machine FreeBSD is an advanced operating system for x86 compatible (including...
  7. Servers Uptime. More Than 356 days, 1 Year Old Phew, time flies… I’ve been working with AIMS for more...
  8. TextMate: Creating New Project in Shell Instantly Been using TextMate recently, really loving it like hell. There...
  9. ssh client hang after a few minutes of inactivity specify the parameter “ServerAliveInterval 60″ in /etc/ssh_config or /etc/ssh/ssh_config. for...
  10. convert epoch using date command date -d ‘<Unix epoch> <epoch date> sec’ e.g. date -d...

Tags: , ,

Leave a Reply