retrieve string from file

hi, I have write a code to retrive data from each line of a file:

sed -e '/^#/d' file.csv | awk '{ printf "TEST,%s:AUX,%s;\n", $0, "'A'"}' > 
pippo.txt

where the input file.csv was like this:

1234
2345
2334
3344

and the output of my code is a file with:

TEST,1234:AUX,A;
TEST,2345:AUX,A;
TEST,2334:AUX,A;
TEST,3344:AUX,A;

###############################
Now I have a different input file

1234,3
2345,1
2334,2
3344,1

And for each line I need to retrive the first and the second number(the two separeted by the comma)

I need an output like this:

TEST,1234:AUX,3;
TEST,2345:AUX,1;
TEST,2334:AUX,2;
TEST,3344:AUX,1;

I'm having a lot of problems writing this new code, can somebody help me?

This might help

awk '{ FS="," } { print "TEST,"$1":AUX,"$2";" }' filename

while read line
do
        echo $line | awk -F, '{print "TEST,"$1":AUX,"$2";"}'

done < pippo.txt

i hope it will work fine.

Using sed

sed 's/\(.*\),\(.*\)/TEST,\1:AUX,\2;/' file

or a loop

while IFS="," read a b;do echo "TEST,$a:AUX,$b;";done <file

posted in error

printf "TEST,%s:AUX,%s;\n" $(sed 's/,/ /g' filename)

Or using Perl:

$
$ cat f7
1234,3
2345,1
2334,2
3344,1
$
$ perl -F, -lane 'print "TEST,$F[0]:AUX,$F[1];"' f7
TEST,1234:AUX,3;
TEST,2345:AUX,1;
TEST,2334:AUX,2;
TEST,3344:AUX,1;
$
$

tyler_durden

Thank you all very much!

All codes where well working!