Home Software LaTex CV

Table of Contents

Module: do noahprogs/do.py
Imported modules   
import commands
import cp
import glob
import os
import re
import string
import sys
import types
Functions   
evalInputList
getRoot
main
  evalInputList 
evalInputList ( listname )

Determine if an input string is a file to be read, an expression to be expanded, or a comand to be executed. If str can not be read, evaluated, or expanded, it is passed back as a list.

  getRoot 
getRoot ( str )

  main 
main ()

%(filename)s

Iteration of a command over a list. The list can be supplied using a list file with the -l argument, as a list of arguments, as an expression to be evaluated or expanded, or as some combination of these methods. This program has some of the functionality of the unix find and xargs commands, but has simpler syntax, and has some nice filename replacement features.

{{c Command. Multiple commands can be specified using a semicolon delimiter. The entire command string must be quoted. Use of the curly brackets results in the following behavior (also see examples below):}} cp {} given file1.seq --> cp file1.seq cp {} {f,p} given file1.seq --> cp file1.seq pile1.seq cp {} {.pep} given file1.seq --> cp file1.seq file1.pep cp {} {/} given mydir/file1.seq --> cp mydir/file1.seq file1.pep cp {} newdir/{/} given mydir/file1.seq --> cp mydir/file1.seq newdir/file1.pep

{{l List of elements. Can be a list file or - for stdin. Blank lines are skipped.}} {{e Expression to be evaluated as a python expression and added to the list of items over which to iterate.}} {{k Check. Prints the list of commands to stdout instead of executing.}} {{v verbosity level: 1 prints command before execution 1}} {{h Print documentation.}} {{f Force. Iteration over list continues even when a command fails.}} {{n Newline. Print a newline character after each subcommand if one wasn't added upon execution}} {{s Silent. Suppress printing of stderr}} {{version print version info and exit}}

Examples:

%% do.py -e="1 2 3 4 5 6 7".split() -c=echo contents of file {} > f{}.seq %% ls f1.seq f2.seq f3.seq f4.seq f5.seq f6.seq f7.seq

%% do.py f[1-2].seq -c=echo {}; cat {} -n f1.seq contents of file 1 f2.seq contents of file 2

%% ls f[3-4].seq > listfile %% do.py -l=listfile -c=echo {}; echo {f,S}; echo {.pep}; cp {} {.seq,_2.seq} -k echo f3.seq; echo S3.seq; echo f3.pep; cp f3.seq f3_2.seq echo f4.seq; echo S4.seq; echo f4.pep; cp f4.seq f4_2.seq

%% do.py -l=listfile -c=echo {}; echo {f,S}; echo {.pep}; cp {} {.seq,_2.seq} f3.seq S3.seq f3.pep f4.seq S4.seq f4.pep

%% ls f1.seq f2.seq f3.seq f3_2.seq f4.seq f4_2.seq f5.seq f6.seq f7.seq listfile

%% ls f[1-3].seq | grep -v 3 | do.py -c=echo {}; cat {} f1.seq contents of file 1 f2.seq contents of file 2

%(version)s


Table of Contents

This document was automatically generated on Thu Feb 27 16:52:00 2003 by HappyDoc version 2.1