0

I run this command line:

awk -F "\\t" "NR>=%startcounter%&&NR<=%endcounter% { print """UPDATE tArtikel SET fVKNetto =""" $6 """ WHERE cArtNr = """ $1 """ """;}" fil_a.txt file_b.txt

The result is:

UPDATE tArtikel SET fVKNetto =27,67 WHERE cArtNr = 60160 

Is there a easy way in awk to replace the comma, with a dot?
It should be:

UPDATE tArtikel SET fVKNetto =27.67 WHERE cArtNr = 60160 

I found some solutions, but I would like to make it as short as possible. It would be perfect if the command has not to be completely changed.

Thank you for your help!

Note: I use Winawk

2
  • yes, there is, but you need provide the sample content in file_a and file_b
    – BMW
    Dec 16, 2014 at 1:55
  • 1
    Add sub(/,/,".",$6); (with appropriate cmd.exe quoting) before the print statement. Dec 16, 2014 at 1:57

1 Answer 1

1

This replaces all , with .

awk -F "\\t" "{gsub(/,/,".")} NR>=%startcounter%&&NR<=%endcounter% { print """UPDATE tArtikel SET fVKNetto =""" $6 """ WHERE cArtNr = """ $1 """ """;}" fil_a.txt file_b.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.