On 12/02/13 Alan Sondheim <[email protected]> wrote:
>
>
>excavation of the mind
>
>$ grep depressive /*. | wc 54 486 4247 $ grep manic /*. | wc 102
>882 7824 $ grep schizophrenic /*. | wc 19 238 1820 $ grep neurotic
>/*. | wc 180 1902 14985 $ grep suicidal /*. | wc 147 1424 11449 $
>grep happy /*. | wc 539 6703 46086 $ grep psychotic /*. | wc 110
>1107 9064 $ grep exhibitionist /*. | wc 23 541 4295 $ grep
>narcissist /*. | wc 45 685 5494 $ grep voyeur /*. | wc 189 2013
>16131 $ grep autistic /*. | wc 1 10 86 $ grep convivial /*. | wc 3
>22 206 $ grep selfish /*. | wc 152 1555 11160 $ grep generous /*.
>| wc 46 485 3488 $ grep optimistic /*. | wc 22 236 1851 $ grep
>pessimistic /*. | wc 11 117 925 $ grep sane /*. | wc 146 1162 9417
>$ grep insane /*. | wc 106 730 6252 $ grep crazy /*. | wc 228 2312
>17263 $ grep normal /*. | wc 488 6223 46574 $ grep mental /*. | wc
>1696 21561 173464 $ grep sexist /*. | wc 4 52 348 $ grep sexual
>/*. | wc 3053 31696 262337 $ grep loving /*. | wc 385 3887 29654 $
>grep hating /*. | wc 53 516 3716 $ exit
>
>Script done on Tue Feb 12 02:45:25 2013
>
couldn't resist!
here's a one liner which would be more readable as a script:
WORDS="image audio text art like insane bash painting pathetic awful
terrible nightmare paint colour plastic machine buckets james morris
artist linux release program code develop dumb stupid clever really
idiot depressed depressing bored boring useless sane pain television
hate love sex care rest vivid actual thought mundane work hour beauty
sensitive beautiful upset anxious dream sunny myself race mtb manic
packing fast"; WORDS=$(echo $WORDS | tr " " "\n" | sort);for WORD
in $WORDS; do printf "%-12s" "${WORD}:"; grep -ishow $WORD * | wc
-w;done
1) assign a string of space seperated words to var WORDS
2) convert, using tr, the spaces in the string to newlines ("\n")
3) alphabetically sort the "\n"-separated string of words.
4) reassign WORDS with result of sort
5) loop through each WORD in WORDS
6) print each WORD, formatting with padded spaces
7) use grep to peform
* -i - case insenstivie search
* -w - for whole words only
and output using:
* -s - supress messages (file not found etc)
* -h - no output of filename
* -o - only show matching parts of line, nothing else
8) count number of words grep outputs
actual: 9
anxious: 0
art: 1139
artist: 57
audio: 510
awful: 4
bash: 16
beautiful: 7
beauty: 0
bored: 4
boring: 2
buckets: 5
care: 11
clever: 3
code: 292
colour: 90
depressed: 0
depressing: 1
develop: 0
dream: 58
dumb: 13
fast: 19
hate: 2
hour: 8
idiot: 1
image: 784
insane: 4
james: 73
like: 193
linux: 112
love: 4
machine: 45
manic: 0
morris: 38
mtb: 13
mundane: 6
myself: 54
nightmare: 1
packing: 5
pain: 6
paint: 40
painting: 263
pathetic: 1
plastic: 13
program: 36
race: 4
really: 40
release: 72
rest: 9
sane: 0
sensitive: 2
sex: 0
stupid: 4
sunny: 3
television: 0
terrible: 0
text: 1635
thought: 33
upset: 2
useless: 1
vivid: 0
work: 181
note: some words like "text" for example, are used each time, my
website should display some text, "image" is used each time it should
display an image, and "art" is used each time it should display some
"art" ;-)
_______________________________________________
NetBehaviour mailing list
[email protected]
http://www.netbehaviour.org/mailman/listinfo/netbehaviour