Question: I have a list of strings with the following format. What commands could I use to extract the respective sections. I was thinking of using grep to extract the keywords ie: ADD, username(atra522) etc.. 
How should I approach this problem?

```
cop1010 ADD atra522,Allison Track,CT,canada

```

I know how to use cut or awk to get all the fields by looking for the commas, but I don't know how to make it work with the first field "cop1010 ADD atra522".

Answer: 
You said `bash`, so let's do it all with shell builtins:

```
$ inp="cop1010 ADD atra522,Allison Track,CT,canada"
$ IFS=, fields=($inp)
$ echo ${fields[0]}
cop1010 ADD atra522
$ echo ${fields[1]}
Allison Track
$ echo ${fields[2]}
CT
$ echo ${fields[3]}
canada
$ IFS=\  cmd=(${fields[0]})
$ echo ${cmd[0]}
cop1010
$ echo ${cmd[1]}
ADD
$ echo ${cmd[2]}
atra522
$ 

```

You can set them all as variables (instead of echoing them), and never need to spawn a subshell to run `awk`, `cut`, or any other tool.
You can use awk's `split` function to further split the first field into an array e.g.

```
echo 'cop1010 ADD atra522,Allison Track,CT,canada' | 
  awk -F, '{
    split($1,a,"[ \t]+");
    if (a[2] == "ADD") {
      printf "Adding user: %s\n", a[3];
    }
  }'

```