strip csv file

Hi everyone,
I hope someone can help me:
i am trying to get some info from a csv file, after i awk the column i need , i made a selection and output it in a file.
now i need to get a list from this file, but i stuck with some fields.

basically i have a text file with next data:

3 ,"Simone Johnson"
6 ,"Niels Blaat"
7 ,"Peter Pan"
16 ,"Frans de Boer- Randall Jack- Hanneke Truus- Jaap Doos"
17 ,"Jaap Bart"
21 ,"Kees Piet"

and the output must be:

Simone Johnson 3
Niels Blaat 6
Peter Pan 7
Frans de Boer 16
Randall Jack 16
Hanneke Truus 16
Jaap Doos 16
Jaap Bart 17
Kees Piet 21

thanks a lot for youre help.

Try this

awk -F',|"' '{split($3,x,"- ");for(i=1;i<=length(x);i++){print x" "$1}}' infile

regards,
Ahamed

Try:

perl -F"," -lane '$F[1]=~s/\"//g;@x=split /- /,$F[1];for $i (@x){print "$i $F[0]"}' file

Thank you guys, it works great :slight_smile: