[conspire] (forw) Re: UNIX beginner asks: what's a good forum for q's about command-line utilities?

Mark Weisler mark at weisler-saratoga-ca.us
Thu Sep 2 19:34:28 PDT 2010

Hash: SHA1

Rick Moen wrote:
> ----- Forwarded message from Michael Gray <michaelcgray at gmail.com> -----
> Date: Wed, 1 Sep 2010 12:11:58 -0700
> From: Michael Gray <michaelcgray at gmail.com>
> To: rick at linuxmafia.com
> Subject: UNIX beginner asks: what's a good forum for q's about command-line
> 	utilities?
> X-Spam-Status: No, score=0.7 required=4.0 tests=BAYES_50,DKIM_SIGNED,
> 	autolearn=ham
> 	version=3.3.1
> Hi Rick,
> We met at your house some time last year at one of your installfests. I
> don't know whether you remember me; I brought in a circa-1995 desktop system
> with a non-standard processor (a copy of a copy, you said), and you
> recommended I get a netbook. I did. A man named Christian helped me with the
> installation; I have forgotten his last name. He was from northern Europe
> somewhere. I now have a netbook running Ubuntu. I have read, and hopefully
> internalized, the essay you co-wrote with Eric Raymond entitled "How to ask
> good questions" or something quite similar. Probably mine is a trivial,
> solved problem, but I have been unable to solve it despite considerable
> effort, otherwise I wouldn't be asking you for help. Please correct any
> breaches of question protocol, and feel free to forward this to someone who
> you think can help, though I'd prefer if you stripped off this introductory
> paragraph and just forwarded the technical question that follows.
> I want to move multiple files to a directory. I know how to use mv to do
> this one file at a time (i.e., mv [file] [directory]), and I figure there
> must be a way to do it en masse, without naming each file explicitly. Below
> is my conversation with the system. On the off chance that mv supported
> perl-like regular expressions, I tried using .* as a wildcard, but mv does
> not like that. ("August, 2010" is a directory; anything named "August x,
> 2010", where x is a numeral, is a file. I have deleted the full pathname for
> privacy and inserted a few hard carriage returns for readability.)
>> $ ls
>> August, 2010         August 29, 2010     August 5, 2010.odt
>> August 25, 2010.odt  August 30, 2010
>> August 26, 2010.odt  August 31, 2010
>> August 27, 2010.odt  August 4, 2010.odt
>> $ mv August\ .*,\ 2010 August,\ 2010
>> mv: cannot stat `August .*, 2010': No such file or directory
> I did a google search of "does mv support regular expressions" and a quick
> scan suggested that the answer is no. I googled "passing multiple file names
> to mv", and I found this page, entitled "How can I rename multiple files
> using wildcards?", which offers a solution (to a related problem) that uses
> a shell script:
> http://aplawrence.com/SCOFAQ/FAQ_scotec1rename.html

Hello Michael,
I'm offering a few ideas in case they help.
I see that you have spaces in your file names, like "August 25, 2010.odt".
Unix life is simpler if you can avoid spaces in file names. Also, if you
could simplify and standardize on your file names it would make using
regular expressions easier.

So if "August 25, 2010.odt" could become, say, "August-25-2010.odt" then
using move like this might be possible...

mv August-* MyDirectory

Below is an example that worked for me.

mark at ubuntu10-4:~/Documents/testing$ ls
file.1  file.2  file.3  file.4
mark at ubuntu10-4:~/Documents/testing$ mkdir MyDirectory
mark at ubuntu10-4:~/Documents/testing$ ls
file.1  file.2  file.3  file.4  MyDirectory
mark at ubuntu10-4:~/Documents/testing$ mv file.* MyDirectory
mark at ubuntu10-4:~/Documents/testing$ ls MyDirectory/
file.1  file.2  file.3  file.4
mark at ubuntu10-4:~/Documents/testing$
Version: GnuPG/MacGPG2 v2.0.12 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


More information about the conspire mailing list