Good uses can also be found under Goodies
tcsh-aliases
Directory short-cuts
S
- set a default directory
s shortcut - set an alias
for the current directory ×
g shortcut - go to
G
- go to default directory
D
- gives a list of currently defined short-cuts
Sets an abbreviation that will point to the directory that is current
when
s is issued. The S command defines the default short-cut. Go back
to that
directory with the g command.
______________________________________________________________________________
History enhancement
H
- the old history command (shell built-in)
h target
- history of commands targeted at
ha target - history
of commands containing target anywhere
Example h:
h e
will typically list emacs, exit, elm commands and their parameters
in
a brief format so they can be reissued with a trick of the mouse.
The ha command will scan commands and parameters for the occurrence
of
"target". Also here, the list will be brief.
Directory lists
lsd
- lists all directories
lsx
- lists all executable files
lsx -S 30000 - lists all executable
files less in size than 30 kb
lsl
- lists link-resolved file names. Many options.
lsl -h
- tells more.
lss
- list standard files (avoid links and dirs)
Cleaning
clean
- an alias for rm -f ./.*~ ./*~ core
cleandir dir - cd to dir and
clean. Use e.g. in
find . -type d -exec cleandir {} \;
to clean the directories below ./
cleanf -d
- clean current directory from fortran scrap.
cleandir -f dir - cd to dir and cleanf.
______________________________________________________________________________
ef !*
launches emacs (/hgs/bin/emacswt to be exact, which is emacs
with x-window
resource update for e.g. title) in background
______________________________________________________________________________
vp !*
launches vuepad in background
ne !*
launches nedit in background
nes !*
launches nedit in background with special (MS-DOS) character set
gv !*
launches ghostview in background
______________________________________________________________________________
cutb "cut -d ' '"' \!*'
is cut for blank-delimited fields.
______________________________________________________________________________
ecq longerstring string
returns 0 if string is element of longerstring else 1
Usage:
if ( `ecq $1 abc` == 0 ) then ...
or
ecq $1 abc && { commands for case true }
In sh you can write
if ecq longerstring string; then
statement
fi
beak
To test options in call lists (indicated by first character
being "-" (minus) sign)
if [ x`beak $1`x = x-x ]; then
ftpa file [file ...]
www file
locate
Usage: locate 'fns' [[-d directory] [-f]
[-x [size] \
[-F \'options to find\']]
\
[+ options to fgrep] text
like: locate 'filenameselector' + [options to fgrep] text
simplest: locate 'filenameselector' + text
searches for text in the files of the current directory and its subdirectories
btype
Usage: btype.pl [-b back][-c lines ][-n hit][-l] string file ...
Finds $hit'th occurence of $string in $file and lists $back lines before and $lines after.
filename returns FileName, filext returns .ext
Usage typically (sh):
if [ x`filext $1` = x.f ]; then ...
Another example (csh):
foreach file ( /path/* )
diff $file `filename $file`
end
______________________________________________________________________________
Usage: fh filename[.f]
fortran help = print marked-up comment sections
______________________________________________________________________________
purpose_of
Usage: purpose_of *.f
Appends files with records containing 'C:Provides procedure type
name F=filename'
used by search-d4fs and mmisss
______________________________________________________________________________
search-d4f
Usage: search-d4fs [ -d dir ] symbol
Searches a directory for files *.f containing the given symbol to occur
in a C:Provides record.
______________________________________________________________________________
mmisss
Usage: mmisss [-c destinationdir] pgm-short [searchdir]
Finds procedure source files that are listed in pgm-short.err
under "Unresolved symbols"
______________________________________________________________________________
search-ar
mnewer
Usage: mnewer [-c | -d] [-v] p1 p2 - merge newer
-c - do the
copy
-d - do
a 'diff' on the files
-v - verbose
file look-up
p1 - path
to the possibly newer files
p2 - foreach-selector
Example: mnewer ~/Oload/p *.f
tries to find files *.f in ~/Oload/p that are newer than those
in the current directory. If found, the older ones will be replaced
______________________________________________________________________________
mneeds
Usage: mneeds module-short [ dir dir ... ]
After having compiled and linked a program with the map option,
mneeds processes the map file (name = ${module-short}.map) to find
the location of the subroutine files that the module needs.
module-short - the name of the main program excluding the trailinf .f
dir
- directories to look for. Default = $HOME, which
however makes processing very tedious.
The program creates a temporary shell script named temp.bat
______________________________________________________________________________
myar and mynm
myar = ( echo LIBRARY:: $1; ar tv $* )
mynm = ( echo SHARED LIBRARY $1; nm $* )
mynm analyzes some more file types and modifies message accordingly.
These commands are useful inside 'find' scanning a set of libraries.
______________________________________________________________________________
pso -h
Usage: pso infile [outfile]
Adds Postscript preamble to a file
Default outfile = infile; then intermediate copy to /scracth/hgs
______________________________________________________________________________
pc2ux
Usage: pc2ux [[ -t|-T ] file file ... | -c ]'
Purpose: Remove trailing ^M after copying files from an MS-DOS
system.
-t
- find out whether file is a candidate. The name of
each candidate file is printed. Typically, object files
are found candidates; they are not to be considered.
-T
- To remedy above problem, files.o and files.a are excepted
from the test.
-c
- clean; take away temporary file temptemp and backup files *.b
else: Do
the update.
______________________________________________________________________________
lost
clost
Usage: lost string
Purpose: Combine command line arguments to a single long string,
joined
by one blank each.
Output to stdout.
For this purpose,
the arguments must be delimited by \', e.g.
x=`lost \'This
is a long string\'`
The accompanying
script clost returns the number of parameters
that were combined.
Thus, a typical sequence inside a script may
look as follows:
sh: s=`lost $*`; c=`clost $*`; shift $c'
csh: set s=`lost $*`; set c=`clost $*`; repeat
$c shift'
myprog $s -options
$1'
______________________________________________________________________________
rename -h
Usage: rename [-t] [-c] string1 string2
'filenameselector'
where filenameselector is the target set of foreach
command of csh
e.g.
rename eabc 123 'fileabc*'
will rename a file fileabcXX into fil123XX
-t Test mode. The mv-commands are printed but not executed.
-c copy instead of move
Since sed is used, be careful with the dot (.) and the tilde (~) !
To reset backup files the names of which are marked with tildes,
use
rename -b string2 'filenameselector'
where string2 is a unique string preceding the ~ mark
E.g.
rename -b v '*.sv'
to mv WETB.sv~ to WETB.sv
______________________________________________________________________________
tarupd
Usage: tarupd { -1 | -2 | -3 } directory filename
Job -1: copy in and untar
Job -2: tar and copy out
Job -3: tar, copy out, and clean
______________________________________________________________________________
alias dbDJ 'more /usr/sharedprint/configs/active/debug.DeskJet'
alias dbPSL 'more /usr/sharedprint/configs/active/debug.PSL'
______________________________________________________________________________
alias lrd ls -R | fgrep :
Recourse subdir levels
alias lsd ls -F1 !* | fgrep
/
List subdirs
alias lsx ls -F1 !* | fgrep
-e "*"
List executables
alias lzs lz !* | sort -n
List size of files sorted
/bin/lz
List size of files
/bin/du1
du on the top level only.
______________________________________________________________________________
psdj to print (primarily) postscript files on DeskJet with good options.
______________________________________________________________________________
fileage
( /home/hgs/util/p/m/fileage.f /home/hgs/bin/fileage* )
ls | xargs -i fileage -d 100 -s {}
creates a list of files with an age of more than 100 days.
2.207 1024 DOS
2.627
24 DeskJet
2.068 1091 EGS96-tit.fig
2.068 1091 EGS96-tit.fig.bak
2.207 16271 IGS-logindex.htm
2.855
15 PSpreamble
...
... ...
10log age size name
Issue fileage -h for more help
______________________________________________________________________________
date conversion filters
JD yyyy mm dd Returns Julian date
/util/p/m
Options exist. I/O is command line arg / stdout
Help exists: JD -h
cal2dy
Converts calendar date to decimal years.
/util/p/m
Options exist. I/O is stdin / stdout
Help exists: cal2dy -h
rjd2dy
Converts reduced Julian day to decimal years. /sas/p/m
Options exist. I/O is stdin / stdout
Help exists: rjd2dy -h
______________________________________________________________________________
access to binary files, hgs-time series format (*.ts)
tslist -h
tap/m/tslist.f
Usage: tsplot filename [option]
Reads TS BIN data and lists to stdout, time in decimal years.
Option meaning
[default]
-S# - multiply
time series with scale value.
[1]
-Fcode - format code for numeric
field, used for output. [f8.5]
-Tcode - format code for time field,
used for output. [f8.5]
-Y# - offset by
this value.
[0]
-M# - define missing
record symbol.
[internal]
-D - remove
DC-level
-i - time
record is t0+n*dt (from file) instead of decimal year.
-Lcode - Process MC-data. Code specifies
location string.
-ffilename - A way to specify a file name late on the line.
-f filename - ...will also work.
______________________________________________________________________________
Linear regression
fitm(.out) -h sas/p/m/fitm.f
Usage:
fitm.out [options]
Input: stdin Output:
stdout
Purpose: read columns of x y (weight) data and compute
regression
parameters (offset, slope, 95% cfd-limits).
Options:
-Fformat - specify format code; avoid outer
pair of ( ).
Default is list-directed (*).
-S
- Skip weights; will assume uniform.
A nice example:
Given a LaTeX-table
ARJE HASS & 1\,161\,572.521 & 3.6 & 3.3 & 9.2 \\
...
this pipeline works on the distance column and the vertical (=
9.2 here)
sed 's/\\,//g; s/&/ /g' temp.dat | awk '{print
$3,$6}' | fitm.out -S
fitxym.out
Usage:
fitxym.out [options]
Input: stdin Output:
stdout
Purpose: read columns of x y weight_x weight_y data
and compute
regression
parameters (offset, slope, 95% cfd-limits).
Options:
-Fformat - specify format code; avoid outer
pair of ( ).
Default is list-directed (*).
-Oformat - Output format in the case of
-X
-Xx1,x2 - Will print x1 y1 // x2
y2 for straight line plot.
Mutually exclusive (sorry!):
-T[format] - Will print information on slope and error
-C[format] - Will print information on constant and
error
-I[format] - Will print information on intercept and
error
-Ex[scale] - scale factor on sigma x
-Ey[scale] - scale factor on sigma y
______________________________________________________________________________
latex-xref filenameroot
(don't specify file name extensions)
looks up filename.aux for string "citation", looks
up filename.tex for
string "bibitem" and runs a diff on the citation labels.