Thinking Pythonically (was Re: gah! I hate the new string syntax)

Paul Jackson pj at sgi.com
Sat Mar 3 05:52:32 CET 2001


Sorry - couldn't resist the following ...

Carel wrote:
> $ cleartool lock `cleartool lsvob -l | grep ^Tag: data | cut -c 6-`

I think the 'data' (2nd grep arg) should be removed.

And (groan) yet another way to write this would be:

    cleartool lsvob -l | awk '$1 == "Tag:" { print $2; }' | xargs cleartool lock

This way avoids assumptions of the exact number of spaces in
the lsvob output, and works if more vob's need locking than fit
in the system's MAXARGS (God help you if you have a ClearCase
installation _that_ big!).

... I write this trusting that everyone else on this thread has
more sense than to follow this up with yet more ways to write
shell one-liners ... clearly I lack such sense ...

-- 
                          I won't rest till it's the best ...
                          Manager, Linux System Software
                          Paul Jackson <pj at sgi.com> 1.650.933.1373



More information about the Python-list mailing list