We just created this little alias command under our MAC's
OS X Unix to allow us to quickly calculate thelogos on any piece
of text. A book paragraph, chapter, or an entire book's text.
We put this little alias in our .cshrc file under our user
home directory (cd ~). We add aliases to .cshrc using Unix's
VI editor. There are several books to help you learn how to do
this, including, Unix in a Nutshell, and Learning Unix for MAC
OS X.
Place this line among your aliases in .cshrc:
counthe wc <!:1 ; tr \\040 \\012 <!:1 | sort | grep
-cw 'the'
That's all there is to it.
Original of this text had much more instruction in it, but
somehow we lost it. As time goes by, we'll add more instructional
material here.
Thank you for reading, and hope you find this useful.
Here are some other aliases Doug uses
routinely in 2007 copied verbatim from our tcsh .cshrc alias
list (a few proprietary aliases removed...):
2:34:40pm PDR% cd ~
2:34:51pm PDR% vi .cshrc
source /sw/bin/init.csh
set prompt = "%p PDR% "
# The following aliases (save & show: beware! these are potentially
dangerous and can mess up your system;
#use with care and understand how they work prior using. see
www.MACOSXHINTs.com for originals;
#aliases below use these prolifically and original author warns
against using show'd and save'd acronyms in aliases...)
#are for saving acronyms for frequently used directories
# You can save a directory using an abbreviation of your choosing.
Eg. save ms
# You can subsequently move to one of the saved directories by
using cd with
# the abbreviation you choose. Eg. cd ms (Note that no '$' is
necessary.)
alias save 'sed "/set \!$/d" ~/.dirs > ~/.dirs1;
\mv ~/.dirs1 ~/.dirs; echo set \!* = \"`pwd`\" >>
~/.dirs; source ~/.dirs'
alias sdirs 'source ~/.dirs'
alias show 'cat ~/.dirs'
# source the ~/.dirs file so that we get the previously set up
variables if ( -f ~/.dirs ) source ~/.dirs
alias cmpforaft "cd MACHTML; h2u <before.html | perl
rmn | perl embrak | sed -e "s/font/FONT/g" | sed -e
"s/\<i\>/\<I\>/g" | sed -e "s/\<\\i\>/\<\\I\>/g"
>after.html; h2u <\!:1 | sed -e "s/font/FONT/g"
| sed -e "s/\<i\>/\<I\>/g" | sed -e "s/\<\\i\>/\<\\I\>/g"
>afterall.html; sdiff -s -w200 after.html afterall.html |
less"
alias today "grep -h '`date +%m/%d`' /usr/share/calendar/calendar.*"
alias delblklin 'sed -e "/^$/d"'
alias acrlnkerr 'whis "Us%BEd"'
alias doviolet "cd Batch; m2u <classical_to_violet.txt
>classical_to_violet.bat; cp classical_to_violet.bat /Qtx_MAC_HTML/;
wait; cd MACHTML; undoviolet \!:1 | sed -f classical_to_violet.bat
| less >tmp.html; cp tmp.html \!:1; pr -t bell;"
alias undoviolet "m2u <\!:1 | tr \\012 \\040 | sed -e
's/ */ /g' | sed -e 's/<FONT COLOR="\""#660066"\""
SIZE="\""+1"\"">\([A-Za-z][A-Za-z]*\)\(<\/FONT>\)/<FONT
COLOR="\""#000000"\"">\1<\/FONT>/g'
| sed -e 's/<B><I><FONT COLOR="\""#660066"\""
SIZE="\""-1"\"">\([A-Za-z][A-Za-z]*\)\(<\/FONT><\/I><\/B>\)/<I><FONT
COLOR="\""#000000"\"" SIZE="\""-1"\"">\1<\/FONT><\/I>/g'
| sed -e 's/<B><FONT COLOR="\""#660066"\"">\([A-Za-z][A-Za-z]*\)\(<\/FONT><\/B>\)/\1/g'
| sed -e 's/<FONT COLOR="\""#660066"\"">\([A-Za-z][A-Za-z]*\)\(<\/FONT>\)/\1/g'
| sed -e 's/<B><FONT COLOR="\""#660066"\""
SIZE="\""-1"\"">\([A-Za-z][A-Za-z]*\)\(<\/FONT><\/B>\)/<FONT
COLOR="\""#000000"\"" SIZE="\""-1"\"">\1<\/FONT>/g'"
alias apacheacclog "less </private/var/log/httpd/access_log"
alias apacherrlog "less </private/var/log/httpd/error_log"
alias pl2cgi "cd libwebdoc; m2u <\!:1.txt >/Library/WebServer/CGI-Executables/\!:1;
cd libwebcgix; perl -w \!:1; chmod ugo=rwx \!:1;"
alias cpgif "cd MACGIFs; cp \!:1 /volumes/Beths_G4_Lap_HD/Library/WebServer/Documents/Quantonics%20Site%20GIFs/;
cp \!:1 /volumes/Dougs_Tit_G4_Lap_HD/Library/WebServer/Documents/Quantonics%20Site%20GIFs/;
cp \!:1 /Library/WebServer/Documents/Quantonics%20Site%20GIFs/; cp \!:1 /Quantonics\
Site\ GIFs/; cp \!:1 /volumes/Beths_G4_Lap_HD/Quantonics\ Site\
GIFs; cp \!:1 /volumes/Dougs_Tit_G4_Lap_HD/Quantonics\ Site\
GIFs; cp \!:1 /volumes/Beths_G4_Lap_HD/Quantonics%20Site%20GIFs/; cp \!:1
/volumes/Dougs_Tit_G4_Lap_HD/Quantonics%20Site%20GIFs/; cd Batch; pr -t bell;"
alias coined "mac2win1zhtml Coined_Quantonic_Terms.html
; wait ; cpcoinun; wait; cd Batch; pr -t bell; "
alias cpcoinun "cd un; cp Coined_Quantonic_Terms.html /Qtx_MAC_HTML/Coined_Qtc_Terms_Unrem.html"
alias icurl "cd Batch ; cp icurl.txt icurl ; cp icurl /Qtx_Access_Logs/
; cd QALogs ; m2u < \!:1 | cut -f 1 | perl icurl | less >
\!:2" ## line count and mark url domain lines in tabbed
access log
alias CpM "/Developer/Tools/CpMac"
alias ls "/bin/ls -a"
alias m2u "tr \\015 \\012"
alias u2m "tr \\012 \\015"
alias h2u "tr -d \\015"
# Spell check html file:
alias qdict "cd QELRun; m2u <\!:1 | tr \\040 \\012 |
tr '[<>!\-/;|\ =:_@^?\~{}\[\]#,]' ' ' | sed -e 's/H5W/HW/'
| tr '[0-9]' ' ' | tr \\042 \\040 | tr \\047 \\040 | tr \\050
\\040 | tr \\051 \\040 | tr \\044 \\040 | tr \\045 \\040 | tr
\\046 \\040 | tr \\056 \\040 | tr \\052 \\040 | tr \\053 \\040
| tr \\057 \\040 | tr \\040 \\012 | sort | uniq | less > tmp.txt
; comm -23 tmp.txt qtxdict | less >tmp1.txt;"
# Update quantonics spell check dictionary:
alias udict "cd QELRun; cat tmp1.txt >>qtxdict; m2u
<qtxdict | sort | uniq | less >tmp.txt; cp tmp.txt qtxdict;
wait; (cd QELRun; cpdict; cd Batch; pr -t bell;)"
alias pchg "cd Batch; m2u <patchg.txt > patchg; tcsh
-s <patchg \!:1; cd MACHTML; cp tmp \!:1;"
alias t2w "tr \\040 \\012 <\!:1 | sort | uniq "
alias cpbatch "cd Batch; cp *.* /volumes/Beths_G4_Lap_HD/Batch_File_Backups/
&; cd Batch; cp *.* /volumes/Dougs_Tit_G4_Lap_HD/Batch_File_Backups/
&;"alias mac2win1zun "cd /HTML/; rm *.*; wait;
cd Batch; cp *.* /HTML/; wait; cd MACHTML; cp \!:1 before.html;
wait; doqtmctx \!:1; cd un; cp \!:1 /HTML/; wait; cp \!:1 /Qtx_MAC_HTML/;
wait; cd /HTML/; ls | wc; wait; grep '\!:1' Sed_Batch_MAC_to_Win_HTML.txt
>Sed_Batch_1z_MAC_to_Win_HTML.txt; m2u <Sed_Batch_1z_MAC_to_Win_HTML.txt
>Sed_Batch_1z_MAC_to_Win_HTML.bat; wait; m2u <Sed_Cmd_MAC_to_Win_HTML.txt
>Sed_Cmd_MAC_to_Win_HTML.bat; wait; tcsh -s <Sed_Batch_1z_MAC_to_Win_HTML.bat
&; wait; cd Batch; pr -t bell"
alias markunresolvedurls "cd QALogs; m2u <\!:1 | sed
's/^\([0-9]*.\)\([0-9]*.\)\([0-9]*.\)\([0-9]*\)\ /unresolved_url-\1\4\.\3\2\1\.nam\
/' | less >log_resolved_urls.txt; pr -t bell"
alias counthe "wc <\!:1 ; tr \\040 \\012 <\!:1 | sort
| grep -cw 'the'"
alias diffgifs "cd / ; ls Quantonics\ Site\ GIFs | sort
> QSG.txt ; ls Quantonics%20Site%20GIFs | sort > QMG.txt ; diff QMG.txt
QSG.txt | less"
alias diffhtml "cd / ; ls Quantonics\ Site\ HTML | sort
> QSH.txt ; ls Qtx_MAC_HTML | sort > QMH.txt ; diff QMH.txt
QSH.txt | less"
alias nodots "cd /Qtx_Access_Logs/; m2u <\!:1 | grep
-v '[.]' | less "
alias makedots "cd /Qtx_Access_Logs/; m2u <\!:1 | sed
-f Make_Dots_Cmd.txt >\!:2" ## Edit Make_Dots_Cmd for
no dots patterns.
alias revdom "m2u <\!:1 | sed -e 's/\(^.*\)\((.*)\)/\1/'
| dotspc | awk -f revcom"
alias webstats "cd /Qtx_Access_Logs/; m2u <\!:1 >access_log;
cd /Qtx_Access_Logs/wwwstat_application/wwwstat-2.0; perl wwwstat
</Qtx_Access_Logs/access_log >/Qtx_Access_Logs/\!:2"
alias ttop 'top -ocpu -R -F -s 2 -n30'
alias qtxsiteusers 'cd /Batch_File_Backups/; cp Site_Users_Cmd.txt
/Qtx_Access_Logs/; cd /Qtx_Access_Logs/; m2u <Site_Users_Cmd.txt
>Site_Users_Cmd.bat; m2u <\!:1 | sed -f Site_Users_Cmd.bat
>\!:2; rm Site_Users_Cmd.txt; rm Site_Users_Cmd.bat'alias
qtxsitecontent 'cd /Batch_File_Backups/; cp Site_Content_Cmd.txt
/Qtx_Access_Logs/; cd /Qtx_Access_Logs/; m2u <Site_Content_Cmd.txt
>Site_Content_Cmd.bat; m2u <\!:1 | sed -f Site_Content_Cmd.bat
>\!:2; rm Site_Content_Cmd.txt; rm Site_Content_Cmd.bat'
alias showoccurrences "grep -c \!:1 /Qtx_MAC_HTML/*.* |
grep ':' | grep -v '[0]' | less"
alias shourl "cd QALogs; m2u <\!:2 | grep -h \!:1 | sort"alias
updtxtlogsrt "cat \!:1 >>log.txt; accesslog log.txt;
sort +0n <log.xls >log.srt"
swapcol | sort -nr | uniq | less >user_list.xls; nodots user_list.xls"
# 1st grep dumps gifs; 2nd grep dumps SEs (Search Engine hits)
alias whiswc 'grep -l \!:1 /Qtx_MAC_HTML/*.* | wc'
alias whiswctot 'grep -h \!:1 /Qtx_MAC_HTML/*.* | wc'
alias whis2 'grep -l \!:1 /Qtx_MAC_HTML/*.* >t0; grep -l \!:2
/Qtx_MAC_HTML/*.* >t1; cat t0 t1 | sort | uniq -d | less'
alias whis 'grep -l \!:1 /Qtx_MAC_HTML/*.* | less'
alias whil 'grep -l \!:1 /Qtx_Access_Logs/*.* | less'
alias whis3 'grep -l \!:1 /Qtx_MAC_HTML/*.* >t0; grep -l \!:2
/Qtx_MAC_HTML/*.* >t1; grep -l \!:3 /Qtx_MAC_HTML/*.* >t2;
cat t0 t1 | sort | uniq -d >t3; cat t0 t2 | sort | uniq -d
>t4; cat t3 t4 | sort | uniq -d | less'
alias whiw 'grep -l \!:1 /Quantonics\ Site\ HTML/*.* | less'
alias whib 'grep -l \!:1 /Batch_File_Backups/*.* | less'
alias dotspc "tr '.' ' '"
alias html2words "cd /Quantonics\ Site\ HTML/; cat [A-Za-z]*.html
>all; m2u <all | tr \\040 \\012 | tr '[<>\!\-/;|\
=:_@^?\~{}\[\]#,]' ' ' | tr '[0-9]' ' ' | tr \\042 \\040 | tr
\\047 \\040 | tr \\050 \\040 | tr \\051 \\040 | tr \\044 \\040
| tr \\045 \\040 | tr \\046 \\040 | tr \\056 \\040 | tr \\052
\\040 | tr \\053 \\040 | tr \\057 \\040 | tr \\040 \\012 | sort
| uniq | less >words; rm all"
@
".cshrc" 85L, 17057C
Here's a portion of our classical to
quantonic violet text file:
#
#Find all violet bold terms in an HTML file. Use results to make
a filter to embolden said terms in any text file.
#
#m2u < Hume_AToHN_B1_P3.html | grep '<[Bb]><[Ff][Oo][Nn][Tt]
[Cc][Oo][Ll][Oo][Rr]="#660066">[A-Za-z].*</[Ff][Oo][Nn][Tt]></B>'
| sed -e 's/\(.*660066\">\)\([A-Za-z].*\)\(<\/[Ff][Oo][Nn][Tt].*$\)/\2/g'
| sort | uniq | less
#
#Embolden (HTML bold and color format) classical terms in any
text file.
# There are two classes of terms: whole words and partial words.
Example of latter is 'di' say in 'different.' Only whole and
partial word classes processed as of 6Dec2006 - Doug.
# To modify whole phrases or sentences will require extra work
here.
#
#Two aliases do and undo violet embolding in HTML files: (in
.cshrc file at cd ~, those " characters have to be encoded
"\"".)
#
#11:31:43am PDR% alias doviolet "cd Batch; m2u <classical_to_violet.txt
>classical_to_violet.bat; cp classical_to_violet.bat /Qtx_MAC_HTML/;
wait; cd MACHTML; undoviolet !:1 | sed -f classical_to_violet.bat
| less >tmp.html; cp tmp.html !:1; pr -t bell;"
#3:42:41pm PDR% alias undoviolet "m2u <!:1 | tr \\012
\\040 | sed -e 's/ */ /g' | sed -e 's/<FONT COLOR="#660066"
SIZE="+1">\([A-Za-z][A-Za-z]*\)\(<\/FONT>\)/<FONT
COLOR="#000000">\1<\/FONT>/g' | sed -e 's/<B><I><FONT
COLOR="#660066" SIZE="-1">\([A-Za-z][A-Za-z]*\)\(<\/FONT><\/I><\/B>\)/<I><FONT
COLOR="#000000" SIZE="-1">\1<\/FONT><\/I>/g'
| sed -e 's/<B><FONT COLOR="#660066">\([A-Za-z][A-Za-z]*\)\(<\/FONT><\/B>\)/\1/g'
| sed -e 's/<FONT COLOR="#660066">\([A-Za-z][A-Za-z]*\)\(<\/FONT>\)/\1/g'
| sed -e 's/<B><FONT COLOR="#660066" SIZE="-1">\([A-Za-z][A-Za-z]*\)\(<\/FONT><\/B>\)/<FONT
COLOR="#000000" SIZE="-1">\1<\/FONT>/g'"
#3:42:51pm PDR%
~=~=~
#
#Here is a candidate list of terms which need to be emboldened
in select HTML files:
#
######
#
#Following list of sed -f 's///g' commands turns a standard
list of classical terms to embolden them violet in any HTML file.
#Use doviolet alias to affect this list. doviolet calls undoviolet
to undo most previously emboldened terms.
#'Most' says that not all bold, italic, and size combinations
have been covered.
#To extend that ability, edit undoviolet alias in (cd ~) tcsh
.cshrc login file.
#Doug - 8Dec2006.
#
#agree
s/\([-> \~\(]*\)\([Aa]gree\)/\1\<B\>\<FONT COLOR="#660066"\>\2\<\/FONT>\<\/B>/g
#bad
s/\([-> \~\(]*\)\([Bb]ad\)/\1\<B\>\<FONT COLOR="#660066"\>\2\<\/FONT>\<\/B>/g
#begin
s/\([-> \~\(]*\)\([Bb]egin\)/\1\<B\>\<FONT COLOR="#660066"\>\2\<\/FONT>\<\/B>/g
#causation
s/\([-> \~\(]*\)\([Cc]\)ausation\([-.,!:;\'\"?]*\)\(
\)/\1\<B\>\<FONT COLOR="#660066"\>\2ausation\<\/FONT\>\<\/B\>\3\4/g
# change lines like this to look like one for 'begin;' much simpler
and better
#causes
s/\([-> \~\(]*\)\([Cc]\)auses\([-.,!:;\'\"?]*\)\( \)/\1\<B\>\<FONT
COLOR="#660066"\>\2auses\<\/FONT\>\<\/B\>\3\4/g
#cause
s/\([-> \~\(]*\)\([Cc]\)ause\([-.,!:;\'\"?]*\)\( \)/\1\<B\>\<FONT
COLOR="#660066"\>\2ause\<\/FONT\>\<\/B\>\3\4/g
#certain
s/\([-> \~\(]*\)\([Cc]ertain\)/\1\<B\>\<FONT COLOR="#660066"\>\2\<\/FONT>\<\/B>/g
#closed
s/\([-> \~\(]*\)\([Cc]losed\)/\1\<B\>\<FONT COLOR="#660066"\>\2\<\/FONT>\<\/B>/g
#condi
s/\([-> \~\(]*\)\([Cc]ondi\)/\1\<B\>\<FONT COLOR="#660066"\>\2\<\/FONT>\<\/B>/g
#common
s/\([-> \~\(]*\)\([Cc]ommon\)/\1\<B\>\<FONT COLOR="#660066"\>\2\<\/FONT>\<\/B>/g
#connect
s/\([-> \~\(]*\)\([Cc]onnect\)/\1\<B\>\<FONT COLOR="#660066"\>\2\<\/FONT>\<\/B>/g
etc., etc., etc.
Doug.
|