legende.sh

mail@pastecode.io avatar
unknown
powershell
2 years ago
516 B
2
Indexable
Never
#!/bin/bash

if [ $# -eq 0 ]; then
        echo "Usage: ./legende.sh nomFichier"
else

        cible="Pierre Maréchal"
        cibleSorted=$( echo $cible | tr [A-Z] [a-z] | sed 's/é/e/g' | grep -o . | sort | tr -d "\n" )

        while read -r line; do
                nameSorted=$(echo $line | tr [A-Z] [a-z] | sed 'y/çéëî/ceei/' | grep -o . | sort | tr -d "\n")
                if [ $nameSorted == $cibleSorted ]; then
                        echo $line
                fi
        done < $1
fi