[Top][All Lists]

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

Re: OT: automation

From: Arne Babenhauserheide
Subject: Re: OT: automation
Date: Thu, 29 Oct 2009 08:34:50 +0100
User-agent: KMail/1.12.2 (Linux/2.6.30-gentoo-r5; KDE/4.3.2; x86_64; ; )


Am Mittwoch, 28. Oktober 2009 20:31:46 schrieb Sergiu Ivanov:
> > mmv?
> I'd rather agree with antrik here, because stuffing all these
> operations in a single command seems a little bit useless, IMHO.

That's something where I also agree, though. 

The scripts I mean are these small utilities which can do what I need - and 
exactly that. 

        - babsearch_n_replace.py [options] "orig str" "new str" file1 dir1 
file2 file3

It has two additional (relevant) options: 
        --dry-run -> don't change anything
        --suffixes='<.txt,.html>' - comma-seperated list of suffixes to act on. 

I need that sometimes ("damn, why do we have to change the name of this 
character after all text is written?!"), but very seldomly, and so it's far 
easier for me to just call 

        babsearch_n_replace.py --help

and then follow these instructions than to do it with the shell. 

(I prefix most of them with "bab", since they really are my private tools. One 
other example is "babplay_randomly.py", which just plays all passed files and 
all files in passed directories (recursing) via mplayer - whenever my Amarok 
wines, that script is my main music box :) ). 

> > 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 :-)

I think it might be "Python feels like home for me"-specific ;) 

Also when I use sed I often end up with 
"command unterminated" -> damn, I forgot to escape something :( 

Might be related to having many spaces and non-letter characters in filenames, 
since the OS and tools damn well should not restrict how I name my files :)

> 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
> case-specific.

I tried that a few times, but when I found out that it costed me far more time 
than it saved me, I stopped doing it. 

But this likely also stems from the extra chars in filenames... 

> I do agree with you :-)
> Actually, I believe antrik referred to professional programmers, too.
> But I may be wrong, of course.

Then I hope he doesn't talk about the Eclipse users - who make up a not 
neglectable share of coders today (it's too far from my shell for my taste... 
I decided to mostly use Emacs, and though Eclipse looks nicer, I only really 
miss easy refactoring - which I'm sure emacs can do, too, I just don't yet 
know how). 

I assume he talks about efficient UNIX programmers. 

Best wishes, 

--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- 
   - singing a part of the history of free software -

Attachment: signature.asc
Description: This is a digitally signed message part.

reply via email to

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