I'm trying to find all the unique values in a column. However, with this command I'll also get the header row. How do I skip that?
awk -vFPAT='([^,]*)|("[^"]+")|","' '{if ($2!~/NULL/) {print $2}}' Files/* | sort | uniq -c | sort -n | wc -l
Sample data is as:
"link","shared_story","101","52
"link","published_story","118","100
"link","published_story","134","51
"link",NULL,"152","398
"link","shared_story","398","110
Sample data
your sample input or expected output? I thought it was sample input but then you talk about a "header row" in your question and that doesn't seem to be present in your "Sample data". Whichever it is, input or output, please [edit] your question to add the other one too. – Ed Morton Oct 15 '20 at 17:02FPAT
definition you have("[^"]+")|","
- what string are you trying to match with","
that isn't matched with"[^"]+"
? 2) The last field on each line of your "Sample data" starts with a double quote but has no terminating double quote - is that really what your data looks like? If not then please fix your example. – Ed Morton Oct 15 '20 at 17:04