1fstrcmp(1)                  General Commands Manual                 fstrcmp(1)
2
3
4

NAME

6       fstrcmp - fuzzy comparison of strings
7

SYNOPSIS

9       fstrcmp [ -p ] first‐string second‐string
10       fstrcmp -w first‐string second‐string
11       fstrcmp -a first‐file second‐file
12       fstrcmp -s needle haystack...
13       fstrcmp --version
14

DESCRIPTION

16       The  fstrcmp command is used to make fuzzy comparisons between strings.
17       The “edit distance” between the strings is printed,  with  0.0  meaning
18       the strings are utterly un‐alike, and 1.0 meaning the strings are iden‐
19       tical.
20
21       You may need to quote the string to insulate them from the shell.
22

OPTIONS

24       The fstrcmp command understands the following options:
25
26       -a
27
28       --files-as-bytes
29               This option is used to compare two files as  arrays  of  bytes.
30               See fmemcmp(3) for more information.
31
32       -p
33
34       --pair  This  option is used to compare two strings as arrays of bytes.
35               This is the default.  See fstrcmp(3) for more information.
36
37       -s
38
39       --select
40               This option is used to select the closest needle from the  pro‐
41               vided  haystack alternatives.  The most similar (single) choice
42               is printed.  If  none  are  particularly  similar,  nothing  is
43               printed.   See  fstrcmp(3) for more information.  See below for
44               example.
45
46       -V
47
48       --version
49               This option may be used to print the  version  of  the  fstrcmp
50               command, and then exit.
51
52       -w
53
54       --wide-pair
55               This  option  is  used  to  compare  two  multi‐byte  character
56               strings.  See fstrcoll(3) for more information.
57

EXIT STATUS

59       The fstrcmp command exits with status 1 on any error.  The fstrcmp com‐
60       mand only exits with status 0 if there are no errors.
61

EXAMPLE

63       The  fstrcmp  --select  option may be used in a shell script to improve
64       error messages.
65              case "$action" in
66              start)
67                  start
68                  ;;
69              stop)
70                  stop
71                  ;;
72              restart)
73                  stop
74                  start
75                  ;;
76              *)
77                  echo "$0: action \"$action\" unknown" 1>&2
78                  guess=`fstrcmp --select "$action" stop start restart`
79                  if [ "$guess" ]
80                  then
81                      echo "$0: did you mean \"$guess\" instead?" 1>&2
82                  fi
83                  exit 1
84                  ;;
85              esac
86       Thus, the error message frequently suggests the correct action  in  the
87       face of simple finger problems on the command line.
88

SEE ALSO

90       fstrcmp(3)
91               fuzzy comparison of strings
92
93       fstrcoll(3)
94               fuzzy comparison of two multi‐byte character strings
95
96       fstrcmpi(3)
97               fuzzy comparison of strings, integer variation
98
100       fstrcmp version 0.7
101       Copyright (C) 2009 Peter Miller
102       Peter Miller <pmiller@opensource.org.au>
103
104       The  comparison  code is derived from the fuzzy comparison functions in
105       GNU Gettext 0.17.  The GNU Gettext comparison functions were, in  turn,
106       derived from GNU Diff 2.7.
107
108       Copyright (C) 1988-2009 Free Software Foundation
109
110
111
112                                                                    fstrcmp(1)
Impressum