[LBo] Moving files beginning with upper case - Exercise chapter 3
James Allen
jfallen at gmail.com
Sun Nov 19 01:14:55 CET 2006
On 11/18/06, Anita Lewis <a.lewis at linuxbasics.org> wrote:
> mv [A-Z]* uppercase-dir
To move mulitple files a for loop or find with -exec should work. I
know I have done it before but can't remember how off of the top of my
head :-(
>
> But this is not working. Obviously this is not correct.
>
> ls [A-Z]* doesn't work either.
>
> This gives almost what I want, but includes a file/directory that has a
> cap in it, but not at the beginning:
It should work but when I do it, it shows all recursively throughout
the directory structure. To get the desired output I have to do:
find -maxdepth 1 -name "[A-Z]*" {} \;
>
> ls |grep [A-Z]
ls -1 | grep ^[A-Z]
^ can be used with grep to get only those that have a capital at the
beginning. I use -1 to make sure the files are in one column before
piping to grep.
>
> The lesson does speak of using the brackets in
> the ls command; and it does work to limit the letters. Interestingly:
>
> ls [V-W]* gives me only those beginning with 'w'
>
> But ls [v-w]* gives me those beginning with v and w.
>
> Has someone solved this? Using Ubuntu Edgy if that matters.
>
> Anita
Not working for me either. I think it used to. But is there a
difference with older versions of ls?
James
More information about the QnA
mailing list