Hi!
I found and then adapt the code for my pipeline...
awk -F"," -vOFS="," '{printf "%0.2f %0.f\n",$2,$4}' xxx > yyy
I add -F"," -vOFS=","
(for input and output as csv file) and I change the columns and the number of decimal...
It works but I have also some problems... here my columns
Ubuntum, Bash version: 4.3.46
awk -F"," -vOFS="," '{printf "%0.2f %0.f\n",$2,$4}' xxx > yyy
xxx (input csv file) = I have over 50 columns and over 5000 lines... mix columns (numbers, letters, word, alphanumeric)
.112 , 0.25 , 0.48 , .112
5.232 , 0.5852 , 10.25 , 10.25
8.455 , nd , 10 , 8.455
n.d. , 10.4558 , aa_a , n3d5
-8.55 , -12.458 , 80.985 , -8.55
yyy (output file), it is space and not "," (csv)
0.25 0
0.59 10
0.00 8
10.46 0
-12.46 -9
1) I would need a csv file as output... without replace the "space" to "," using sed or other commands...
2) When I apply the code the alphanumeric letters (ie: n3d5
) or only letter/words ( nd
) become 0.00 (column 2, line 3) and 0 (column 4, line 4). They must be as before, alphanumeric letters or only letter/words
Thanks a lot!!!