I'm trying to write a script that takes a string and then reads the file test and prints the names that starts with a pattern (ignoring case) to another file, the test file contains this data:
u001:x:Laith_Budairi
u002:x:laith_buda
u003:x:bara_adnan
u004:x:Basim_khadir
u005:x:bilal_jarrar
this is what i tried to do:
echo type a pattern to find
read s
cat test | cut -d: -f3 | grep -i '^$s' > printfile
but it doesn't print anything there in the file what do I do ?