(BTW: if you are too lazy to read all of the following, then skip to the last paragraph)
Hello Guys. I'm learning how to write shell scripts in bash, and for my first project I am making a small "survey" program.
I need to make use of the following:
# This is a Comment
<name> ... </name>
<q type=mc> ... </q>
<q type=fr> ... </q>
<op> ... </op>
I plan to use the \ character to escape the < and > characters.
Clearly, I need to parse each character individually and keep track of when I close and open different sections.
The problem is that... off the top of my head, I don't know any basic UNIX command that will let me parse the characters in a line!
Here are the following restrictions:
1. The shell script MUST be in bash. Yes, I know something else such as C, Perl, Python, or whatever is much better suited, but that is not what I'm trying to learn
2. I will NOT write a portion of the program (ex: the parser) in C and just use it in the shell script (although honestly, I might reconsider)
3. The command has to be a fairly common and simple command that can be found just about anywhere.
However, I am interested in making use out of either sed or awk- as I am yet to learn those
Question is: What simple, basic UNIX command can I use to parse the characters in a line? the command will be used in a bash shell script, and can also include sed or awk (given that I don't know howto use them- just tell me that they're "capable" of doing so and I will look into it)