You are not logged in.
Pages: 1
On my external harddrive I only use upper/lower case letters, numbers, dashes, underscores and dots, to maintain 100% compatibility accross computers and operating systems. The problem is that occasionally I put in by mistake a file that contains a different character, for example a space, accented letter, exclamation mark, single quote, you name it, and I need to find them. Manually specifying those characters I don't want there is unacceptable, there's so many of them that it's nearly impossible to remember them all. What I need is some sort of inverse filtering, where the ok filenames would remain hidden, and 'invalid' names would show.
Any ideas?
Last edited by meph (2012-04-02 18:57:42)
Running arch is like raising a puppy - if you spend a bit of time with it each day and do just a bit of training you'll end up with the most loyal partner you could want; if you lock it in a room and don't check on if for several days, it'll tear apart your stuff and poop everywhere.
Offline
"find" can match regular expressions:
find "$dir" ! -regex "$dir"'/[a-zA-Z0-9._-]*'
and you can normalize names with "tr":
find "$dir" ! -regex "$dir"'/[a-zA-Z0-9._-]*' | tr -dc "[a-zA-Z0-9._\-\n/]"
Offline
use something like
find | egrep -v '^[-a-zA-Z0-9._/]+$'
What happened to Arch's KISS? systemd sure is stupid but I must have missed the simple part ...
... and who is general Failure and why is he reading my harddisk?
Offline
Thank you both, took a little bit from both of you. Don't know why I didn't realize you could give such an extensive strings to grep, also fixing names via tr is helpful.
So thanks again
Running arch is like raising a puppy - if you spend a bit of time with it each day and do just a bit of training you'll end up with the most loyal partner you could want; if you lock it in a room and don't check on if for several days, it'll tear apart your stuff and poop everywhere.
Offline
'locate' instead of 'find' would be quicker, but be sure to run 'updatedb' first and adjust which parts of the system are excluded from the locate database.
Offline
Pages: 1