Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
jaink
Contributor
Contributor

File Data Type: Dynamic - Execute awk command on tSystem to store the output in a file

Hi,

 

I need to check that the number of fields in a file is as expected. As i am using dynamic data type, i am not able to check the same using getCountColumn() function, as it always takes the max number of fields present.

Therefore, as a workaround thought of using awk and storing the rows which matches the expected number of fields to a file.
Also, it is needed to store the non matching rows to a file.

Example - 
source file - a.txt (data type defined as dynamic)
A,B,C
1,2,3
4,5,6,7
8,9

tSystem1 --> (main) tSystem2
Executed command - "" on tSystem
"/bin/bash -c awk -F, '{if(NF == 2) print $0 }' a.txt > b.txt"

But this command is not executed only i guess, because when executed, the command is passed as - '/bin/bash -c awk -F, '{if(NF == 2) print $0 }' a.txt

Please let me know if there is any other solution for the same, or what changes are needed in the existing code?

Labels (2)