Filtre

From rtgkomArkiv
Jump to: navigation, search

På denne side finder du diverse ideer om filter...

Sortering er form for filter...http://www.google.dk/url?sa=t&ct=res&cd=9&url=http%3A//www.cs.dartmouth.edu/%7Edoug/mdmspe.pdf&ei=Z3YVQ9qyHI2OiAKkzpnTDg



#!/bin/bash
#
# Simple spell check filter:
#
# This shell script extracts the text from a text file  (cmd line arg 1)
# and saves the distinct words in  a temporary file
# The words are then compared to those in the file: "words"
# assumed to be present in the current working directory.
# Words not in the file: "words" are displayed and the temporary
# file is deleted.
#
# NOTE: The file /usr/dict/words  is not sorted correctly and does not work.
# Convert /usr/dict/words to correct format by:
# cat /usr/dict/words | tr '[:upper:]''[:lower:]' | sort | uniq > words

#
# Made by: Peter Snoer Jensen
# Date:         2005-08-31
# Idea taken form J. Bentley, Programming Pearls, Addison Wesley 1989
# p. 139.
#
cat $1 | tr '[:upper:]' '[:lower:]' | \
tr --complement '[:lower:]' '\n' | sort | uniq > ./tmp.$$
comm -2 -3 ./tmp.$$ words
rm ./tmp.$$