Question: I have a text file which is of the following format:

```
{
Name: Me
Age:17
Qualification : Doctor
}
{
 Name: You
 Age:21
 Qualification : Another Doctor
}

```

I need to copy the number in the Age lines, '17' and '21' in this case, to another file in this format:

```
17,21.

```

As you can see i am trying to create a File 2 CSV of the numbers in a certain field in File 1. I need to automate this using shell script. Kindly suggest a solution to this.

When I searched on Google, the 'sed' option turned up but I could not figure out a compact solution for this problem.

Thanks in advance for your time and contributions.

Answer: 
Some like this?

```
awk -F: '/Age/ {printf "%s,",$2} END {print ""}' file1 >agefile
cat agefile
17,21,

```
```
@ECHO OFF
SETLOCAL
SET "number1="
(
 FOR /f "tokens=1,2delims=: " %%a IN (q20072209.txt) DO IF "%%a"=="Age" (
  IF DEFINED number1 (
   CALL ECHO %%number1%%,%%b.
   SET "number1="
   ) ELSE SET number1=%%b
 )
)>newfile.txt
TYPE newfile.txt
GOTO :EOF

```

Not at all sure what is supposed to happen if there's more than 1 pair of data elements.
`q20072209.txt` is the name of your input textfile and `newfile.txt` will be produced.