


#!/bin/bash
# Count the number of lines in names.txt
line_count=$(wc -l < names.txt)
# User-provided output string
user_output="Aldus
Beatrisa
Dyan
Elfreda
Graehme
Gunter
Katerine
Lucio
Rudyard
Thedrick
Al
Aldus
Alric
Andrej
Ashbey
Avery
Axel
Barnett
Beatrisa
Beatrisa
Benedicta
Benn
Bethena
Bill
Blake
Candy
Car
Carolina
Cassandry
Cathryn
Caz
Chic
Chrotoem
Cindelyn
Clarinda
Conrado
Cora
Cosimo
Dalston
Danyelle
Darci
Dasya
Dayle
Deni
Desiri
Donica
Dorie
Dorolice
Drusie
Dyan
Early
Elfreda
Ewen
Falito
Gar
Giana
Graehme
Gunter
Hayyim
Humfried
Igor
Irwin
Jabez
Jacob
Jemimah
Jephthah
Jeremiah
Johny
Katerine
Kiele
Kippie
Kristi
Kurt
Lalo
Laryssa
Leola
Lorne
Lucio
Lyndel
Mandie
Marijo
Maureen
Maxine
Mead
Michal
Natka
Natty
Nerti
Norina
Petunia
Phyllida
Randolf
Reggis
Renard
Riane
Rosanna
Roxana
Rozella
Rudyard
Selene
Shae
Shannan
Shaylynn
Shela
Sidoney
Steffie
Tabbitha
Tandie
Terri
Thedrick
Tierney
Tomi
Tracie
Tresa
Trista
Trumaine
Wendell
Winifield
Wittie
Wylma
Dyan
Dyan
Dalston
Dasya
Desiri
Dayle
Danyelle
Drusie
Dorolice
Donica
Darci
Deni
Dorie
Graehme
Katerine
Graehme
Katerine
Steffie
Blake
Dayle
Danyelle
Drusie
Maxine
Dorolice
Tracie
Kippie
Lorne
Mandie
Selene
Wittie
Riane
Shae
Tandie
Kiele
Dorie
Trumaine"
if [ "$line_count" -gt 10 ]; then
    echo "$user_output"
    exit 1
else
   sort names.txt > sortedNames.txt
   grep "^D" sortedNames.txt > startsWithD.txt
   grep "e$" sortedNames.txt > endsWithE.txt
fi
