legende.sh

 avatar
unknown
powershell
3 years ago
516 B
6
Indexable
#!/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
Editor is loading...