In my simple database, it contains text of like, example, soldiers.Name:Rank:Gender:Age:Years of ServiceTom Corporal:Recruit:Male:19:2Nicole Sergeant:Corporal:Female:30:10Daniel Recruit:Sergeant:Male:40:19And my script goes like this:echo Enter name: read nameecho Enter rank: read rankecho Enter gender: read genderecho Enter age: read ageecho Enter Years of service: read yearsgrep $name database.txtIf I enter Corporal into name, the output will showTom Corporal:Recruit:Male:19:2Nicole Sergeant:Corporal:Female:30:10because the string matches under the section name and rank.How do i use delimiter : to categories the search, so if i enter my conditions under rank, it will search just the rank category and not everything else. Thanks in advance.And do up my question instead of down voting.
How to use Cut and Grep command to find data separated by :
grep;cut
grep ^.*:.*:$gender Information.txt | awk -F: '{print $1}'