Using enchant to spell check on the command line

Spell check is a common operation on all text files. All the editors come with built in spell checkers. But if we want to run a spell check on a text document with out opening it we can use enchant.

enchant is a command to check spelling, and also suggest the possible correct spellings. To only list the misspelt words we can use the option -l with the command

Let us say we have a file with the following text in a file called temp

To run a spell check on the file we can use enchant.

We can see that we have list of words that have been misspelled.

To get the line numbers in which the misspelled words are present we can use the option -L.

The first column is the line numbers and the second column the line numbers.

To get suggestions on possible corrections we can use the option -a.

Every line that starts with a & is the output for a misspelled word. The misspelled word is followed by all the possible suggestions.

No comments:

Post a Comment

Follow by Email