[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OT: automation

From: Sergiu Ivanov
Subject: Re: OT: automation
Date: Wed, 28 Oct 2009 21:31:46 +0200
User-agent: Mutt/1.5.20 (2009-06-14)


On Wed, Oct 28, 2009 at 05:23:13PM +0100, Arne Babenhauserheide wrote:
> Am Sonntag, 25. Oktober 2009 11:23:59 schrieb olafBuddenhagen@gmx.net:
> > That's a very bad thing to do. I hate all these mmv and other bullshit
> mmv? 

I've heard of this for the first time, too :-)

google (``man mmv'') told me that mmv is something than can copy,
move, append, or link bunches of files.  Also, it is apparently
possible to ask mmv to perform several operations at once.  The man
page also states that mmv will check for name collisions etc., i.e.
the kind of problems into which one would sometimes unexpectedly run.

I'd rather agree with antrik here, because stuffing all these
operations in a single command seems a little bit useless, IMHO.
> > *much* more valuable knowledge than usage of any specific scripts. This
> > generic knowledge, once obtained, can be reused in all kinds of
> > situations.
> Sometimes I haggle for minutes with a sed script, before I get it
> right. I think I should write me a python script which just takes
> stdin and some python commands as input, executes the commands on
> the file and pipes the result to stdout...
> Something like ... damn ... del 10 lines of unnecessary script ... 
> find -print0 | python -c "from sys import stdin;from os.path import isfile
> files = stdin.read()
> for f in files.split('\0'):
>    if isfile(f):
>       data = open(f).read()
>       d = data.split('orig')
>       print 'new'.join(d)
> "
> (replace "print..." with "open(f, 'w').write('new'.join(d))" to replace in 
> files)
> This is more verbose than a "find (only files) | sed -i s/orig/new/", but it 
> saves me from having to escape all kind of weird stuff in sed... 
> Note: Until today I haggled with sed instead, because I didn't think this 
> would be that easy with python... 

Hm, this may be case-specific :-) For me the sed command is much
easier :-)

The problem might be that I'm often a fan of fast solutions, no matter
how intricate the syntax might be, that's why I'd often invest a lot
of time in learning shell intricacies to be able to code complex
problems in a dozen characters afterward.  But, again, this is
> > This is what UNIX -- and for me at least, also the Hurd -- is really all
> > about.
> But it's only useful to people who often have to do these kinds of tasks. 
I do agree with you :-)

Actually, I believe antrik referred to professional programmers, too.
But I may be wrong, of course.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]