I have a text file with various entries in it. Each entry is ended with line containing all asterisks.
I\'d like to use shell commands to parse this file and assign each
If you want to do it in Bash, you could do something like the following. It uses globbing instead of regexps (The extglob
shell option enables extended pattern matching, so that we can match a line consisting only of asterisks.)
#!/bin/bash
shopt -s extglob
entry=""
while read line
do
case $line in
+(\*))
# do something with $entry here
entry=""
;;
*)
entry="$entry$line
"
;;
esac
done