I have read other questions regarding similar subjects, such as how to parse a text file using shell and Code for parsing a key/value in in file from shell script
These show how to parse a line or field in a line, specifically using grep:
grep MARX_BUILD builds.txt | cut -d= -f2
my problem lies in the fact I need to have each line between two lines as its own item so I can make an array.
I have a file named users.txt with a list of users that is formatted like this:
Authorized Admins:
admin1
admin2
Authorized Users:
user1
user2
user3
So far I have this:
readarray -t users < <(grep "Authorized Admins" users.txt | cut -d '/n' -f2<=
Then I can use an array like "${users[@]}" to use later on to change passwords and add/delete users depending on the list.
What do I put at the end to stop the parsing at the string "Authorized Users"?
Also, how would I change this to parse from "Authorized Users" to end of file?