[Solved] bash, if then script to parse file [closed]
plain bash, though can easily be converted to POSIX sh. #!/usr/bin/env bash in=0 # whether we are inside a ‘virtual’ block # such a block ends once we meet a line that starts with ‘}’ while read -r do if [[ $REPLY =~ ^virtual ]]; then in=1 echo “${REPLY% *}” elif (( in )); then … Read more