Can it output the number of the output line and not shift in the pipe mode?

Maybe aspellthe line number of the output, and not the offset in pipe mode for html and xml files? I cannot read the file line by line, because in this case aspellI cannot identify the closed tag (if the tag is located on the next line).

+5
source share
3 answers

This will lead to the conclusion of all occurrences of error words with line numbers:

# Get aspell output...
<my_document.txt aspell pipe list -d en_GB --personal=./aspell.ignore.txt |

# Proccess the aspell output...
grep '[a-zA-Z]\+ [0-9]\+ [0-9]\+' -oh | \
grep '[a-zA-Z]\+' -o | \
while read word; do grep -on "\<$word\>" my_document.txt; done

Where:

  • my_document.txt - your source document
  • en_GB - your main dictionary choice (for example, try en_US)
  • aspell.ignore.txt - aspell's personal dictionary (example below)
  • aspell_output.txt is aspell output in pipe mode (ispell style)
  • result.txt -

aspell.ignore.txt:

personal_ws-1.1 en 500
foo
bar

example results.txt output ( en_GB):

238:color
302:writeable
355:backends
433:dataonly

, grep -on grep -n.

+3

, ( Windows:(). , , html ( -) , grep to , , .

cat icantspell.html | head -c <offset from aspell> | egrep -Uc "$"
+1

script aspell -a/ispell. , script , 2nd aspell, , aspell, .

#!/bin/bash

set +o pipefail

if [ -t 1 ] ; then
    color="--color=always"
fi

! for file in "$@" ; do
    <"$file" aspell pipe list -p ./dict --mode=html |
    grep '[[:alpha:]]\+ [0-9]\+ [0-9]\+' -oh |
    grep '[[:alpha:]]\+' -o |
    while read word ; do
        grep $color -n "\<$word\>" "$file"
    done
done | grep .

, stdout script , 1, script , script 0.

, script pipefail, , , .. Makefile, script. , : script [[:alpha:]] [a-zA-Z], , -ASCII-, German äöüÄÖÜß . [a-zA-Z] , - .

+1

All Articles