{"version":"1.0","type":"rich","title":"Count disctinct values for each columns of a file with awk","description":"This example uses an awk script to count distinct values in every column of a CSV file, writing each column’s unique entries and their occurrence counts to a separate output CSV named after the original file and column header. The script first extracts the header row to create per-column output files, then iterates over all subsequent rows, tallying values in a two-dimensional associative array keyed by field name and value. In the END block, it splits those keys to write the final counts. The awk code relies on built-in features like the `FS` field separator, the `split` function, and the `SUBSEP` separator for array keys.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-77f8b16230112ea671b0?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}