I'm sorry the title is so convoluted, but I don't know how to explain it better
The context is as follows: imagine a hospital waiting room. Each person who is admitted is given a name, surname, age, identity number, waiting time and priority.
A file, called "patients.txt", is generated with this data:
first_name last_name age identity_number waiting_time_in_seconds priority
(So, there are six columns).
When there are more than 15 patients waiting, a new file (called "priority.txt") should be generated containing those patients with priority 4 and 5.
I know that with if [[ $(wc -l <patients.txt) -gt 15 ]] you can make Bash know when there are more than 15 patients, but how do I establish that ONLY the patients with priority 4 and 5 go to the new file?
Thank you.