TinyApps.Org
Small is beautiful


 HOME

  0. Internet
  1. Text
  2. Graphics
  3. System
  4. File
  5. Misc
  6. Palm
  7. OS X

 BLOG

 DOCS

 FAQ

 RSS (?)





Find ALL CAPS 8.3 filenames which may contain digits #
Given a directory of files like this:
AD2IWFB6.txt
An_Important_File.txt
BB0IA29Q.txt
C2MMT30I.txt
CANTDELETETHISONE.txt
Y9S29CC0.txt
z.doc
ZZQ0LII7.txt
list the ALL CAPS files which are eight characters long, with or without numbers included, and ending in ".txt" like so:
$ ls -1 | ack ^[A-Z0-9]{8}\.txt$
AD2IWFB6.txt
BB0IA29Q.txt
C2MMT30I.txt
Y9S29CC0.txt
ZZQ0LII7.txt
(find -regex had a problem with the regular expression, so just went with ack instead. ack -g REGEX didn't match the regex either, perhaps because it matches based on both the relative path and filename?)

Delete the matching files by simply piping to xargs:
$ ls -1 | ack ^[A-Z0-9]{8}\.txt$ | xargs rm

/nix | Oct 07, 2011



Categories
/blosxom
/eink
/mac
/misc
/nix
/palm
/windows

Blosxom Archive
2012: 5 4 3 2 1
2011: 12 11 10 9 8 7 6 5 4 3 2 1
2010: 12 11 10 9 8 7 6 5 4 3 2 1
2009: 12 11 10 9 8 7 6 5 4 3 2 1
2008: 12 11 10 9 8 7 6 5 4 3 2 1
2007: 12 11 10 9 8 7 6 5 4 3 2 1
2006: 12 11 10 9 8 7 6 5 4 3 2 1
2005: 12 11 10

Blogger Archive
2005: 10 9 8 7 6 5 4 3 2 1
2004: 12 11 10 9 8 7 6 5 4 3 2 1
2003: 12 11 10 9 8 7 6

Ezine Archive
2004: 4 3 2 1
2003: 12 9 8 7 6 5 4 2 1
2002: 12 10 9 8 7 6 5 3 2 1
2001: 12 11 10