0README Scripts |-- 0README obvious |-- ap extract man (1) = user commands from apropos output |-- blone compress sequences of empty lines into one empty line |-- blout delete all empty lines |-- cpr-save copy file; backup destination file first if necessary |-- diffmk insert change marks in text |-- dircmp compare directories - from ATT code |-- dircmp-other compare directories - other dircmp-like scripts | |-- dircmp-efeu.sh | |-- dircmp-jp-unix.sh | `-- dircmp-mit.sh |-- dutree format a du listing by piping through tac and ind |-- ind filter to indent output from du or find |-- intounix convert msdos/cpm/macos files to unix line termination |-- makelex compile lex code |-- rename rename files |-- ttygraph data and plot commands read from stdin or file |-- ttygraph.awk awk script, to process file of data and plot commands |-- whatis-filter-jar compact long lines, cut out garbage in whatis database `-- why for simple minds A set of IMHO useful shell scripts and related stuff, ranging from trivial one-liners to less obvious code; provenance is cited if not local: ap #\- filter only (1) = user commands from apropos output; limit line length, etc. #usage: %ap key-word-list #filter (keep) user commands only from apropos output, #then limit line length, sort, uniq, etc with "whatis-filter-jar" blone #\- replace sequences of empty lines from filelist or pipe with one empty line #usage: %blone [filelist] #replace runs of blank lines (space , form feed, or tab only) #with single blank line #Allyn Fratkin allyn@sdd.hp.com San Diego Division - or - # Hewlett-Packard Company uunet!ucsd!hp-sdd!allyn blout #\- delete empty lines from filelist or pipe #usage: %blout [filelist] #delete blank lines (space or tab only) cpr-save #\- copy file; if destination file exists, back it up before copy #usage: %cpr-save srcfilepath destfilepath #check if destfile exists at destfilepath #if true, then rename destfile=destfile.old, diffmk #\- insert change marks in text #usage: %diffmk [ -- ] file_name1 file_name2 file_name3 #file_name1 and file_name2 are old and new versions of a file #diffmk generates file_name3, which is file_name2 with troff markup #inserted to indicate changes from file_name1 #see man page #[ NB: dircmp was (is?) copyrighted att code; #there are versions without copyright on the net, e.g., opensolaris ] [see also - nrchbar = C program that does change-marks better....] dircmp #\- compare directories #usage: %dircmp -s -d -wn directory directory -s, do not list "same" files; -d, run diff on different files; -w, set width for pretty print (pr) #see man page #[ NB: dircmp was (is?) copyrighted att code; #there are versions without copyright on the net. ] [other versions: http://efeu.cybertec.at/efeu/src/base/pgm/script/dircmp.sh dircmp-efeu.sh - works, but essentially "diff" http://www.mit.edu/afs/net/system/sun4c_41/rsp.01/usr/5bin/dircmp dircmp-mit.sh - same as att code, no copyright symlink /private/var/tmp -> /usr/tmp mics.ee.t.kanazawa-u.ac.jp/~kawakami/auth/shell_sample/dircmp.sh dircmp-jp.sh - closest to att strip all comments (#.... lines) before using, and convert to unix line ends] [Diff --brief is not equivalent.] dutree #\- pipe a du listing through tac and ind #usage: %dutree [directory] #pretty formatting of directory tree output from "du -kx [$*]" #sizes of files are given in parentheses, as number of 1024-byte blocks #[disk space is apportioned in 4k blocks] #mount points are not traversed #symlinks are not followed ind #\- filter to indent output from du or find #usage: %[cat filepath or dirpath list] | ind [-t] #-t, put filesize in left hand column, indent file hierarchy as usual #default is to place filesize in parenthesis after filename #by conor rafferty, stanford #(X-Archive: comp.sources.misc/8709/10) #slightly modified by ja rupley, tucson, arizona intounix #\- convert msdos or cpm or macos files to unix #usage: %intounix [filelist] #convert ascii input from msdos or cpm or macos to unix format: #strip high bits, convert cr[cr...]lf to lf, quit at first ^Z eof; #for macos, convert cr to lf; #use as filter: read from stdin, write to stdout; #or use to convert all files in filelist; #NOTE: converted file overwrites original if input from filelist; makelex #\- compile lex code; default = stdin to a.out #usage: %makelex [ lex_input_file.l [ executable_file ] ] NB: lex one-liners (or several-liners) are great for file modifications where patterns cross line ends. rename #\- rename files; substitute string, or pre/append date or string, or convert to lower case, or truncate; SLOW #usage: %rename # [-x] { {-l,-u,-number}, [{-a,-p,oldstring} {-d,newstring}] } filelist #rename a set of files, #by substituting oldstring by newstring in each filename #by appending|prepending (-a|-p) the newstring or a date (-d) #by converting all to lower case (-l) or upper case (-u) #query before making each change ttygraph #\- data and plot commands read from stdin or file #usage: %ttygraph [filelist] #file of data and plot control commands read by awk #for processing by awk script, "ttygraph.awk" #for details, read the awk source in ttygraph.awk ttygraph.awk #\- awk script, to process file of data and plot commands #ttygraph.awk == #graph - processor for a graph-drawing language # input: data and specification of a graph # output: data plotted in specified area #for details, read the script #from the awk programming language, by a-k-w, addison-wesley, 1988 #modified slightly by j.a. rupley - rupley!local@cs.arizona.edu whatis-filter-jar #\- compact long lines and cut out garbage in whatis database #usage: %[/usr/bin/{apropos,whatis} keyword-list] | whatis-filter-jar #some lines of whatis database have a long list of files/programs #or a long decription #this filter compacts both parts of the whatis database line if size #limits are exceeded #then sorts and retains only unique entries why #\- your helpful confidant #usage: % [query_string] #Newsgroups: alt.sources #Date: 25 Jul 89 11:29:02 GMT #Reply-To: rolf@flame.warwick.ac.uk (Rolf Howarth) #(converted from csh to ksh - jar, tucson, az) other scripts in ../../Code/Configuration/0burn-050529/bin (not exhaustive list): [areacode - see ../src/areacode] [letter manualfeed viewlet - scripts for troffing] [etc......] bash aliases - bash command "alias", or extract from .bash_aliases: [ jar@pbg4 [08:13:24] /Users/jar (2:769)$ cat .bash_aliases | grep "^#.*[\]-" |sed -n -e "s/^#[ ]*//" -e /alias/p | sort ] .. \- "cd .." H \- grep of history list cd \- UNIX cd command to local variant, c cdiff \- colordiff cl \- "clear" cx \- "chmod +x" = change mode to executable dugraph \- du|macosx-odd-char-filter|dugraph h \- "fc -l", shorter mnemonic for history j \- "jobs -l" l \- "ls -F", listing with dir:exec marked /:* l1 \- "ls -adF [$*]", like "l" but no descent into subdir if $* li \- "ls -il", for long ls listing lit \- "ls -ilt", for time-sorted long ls listing lr \- "ls -RF", for nice listing of tree m \- "more", with color esc seq recognized p \- "who + pwd + ps" = user and process info ps \- "ps -auxc" = full ps; psxx = /bin/ps r \- "fc -s", = run previous [history-numbered] command restty \- reset of stty to .profile values rm,rmxx \- alias rm to "can", rmxx to /bin/rm top \- nice set of options xt24 \- change to 80x24 xterm window size xt40 \- change to 80x40 xterm window size xterm24 \- spawn of 80x24 xterm window size, at lower right screen bash functions - bash command "declare -[f,F]", or extract from .bash_aliases: [ jar@pbg4 [08:13:38] /Users/jar (2:770)$ cat .bash_aliases | grep "^#.*[\]-" |sed -n -e "s/^#[ ]*//" -e /function/p | sort ] C \- compile C programs (C adm.c expands to cc adm.c -o adm). apropos \- filter of apropos output: limit line length and sort back \- pop top off stack, cd to new top = previous directory c \- c [arg1 [arg2]] = cd [arg1 [arg2]] and push directory can \- can [-scrfi] filelist = front end for rm; protected by query or mv to ../tmp chmog \- set of mode+owner+group of a file d \- list directory stack, current directory last ff \- find name=$1 under current directory l. \- "ls -dF $1 .[a-zA-Z0-9-_]*" = ls for dot files luc \- "ls -adF .* [!a-z]*" = list . and uc files pop \- pop [n [m]] - pop directory stack item n, or n thru m [default n = m = top] pp \- pp [n] = move directory n to top of stack, and cd to it [default = exchange current and previous directories] psgrep \- extraction of ps (process) info for file=$1 push \- push dirname = push directory onto stack watch \- "tail -f[$1 | nohup.out]" whatis \- filter of whatis output: limit line length and sort John Rupley rupley@u.arizona.edu -or- jar@rupley.com 30 Calle Belleza, Tucson AZ 85716 - (520) 325-4533; fax - (520) 325-4991 Dept. Biochemistry & Molecular Biophysics, Univ. Arizona, Tucson AZ 85721