Find Words in Text

find_words is a simple Bash script (Linux version) to find words in text.  See the spell_check.pl Perl script for sample use.

#!/bin/bash

# find_words:  find words (strings of one or more characters) in a text stream,
#              and output them, converted to lower case [note: this should be
#              optional], one word per line
#              
#              Usage:  find_words [file]

# for tr, the -c option complements SET1, and -s squeezes repeats

if [ "$#" -eq 0 ]; then
        /usr/bin/tr -cs '[A-Z][a-z]' '[\012*]' | /usr/bin/tr '[A-Z]' '[a-z]'
else
        /usr/bin/tr -cs '[A-Z][a-z]' '[\012*]' < $1 | /usr/bin/tr '[A-Z]' '[a-z]'
fi

Open Hand For more examples, see Samples.

 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2008-03-27.   This site is PIKT® powered.
PIKT® is a registered trademark of the University of Chicago.   Copyright © 1998-2008 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
Learn about the
PIKT.conf
config file