Hi All,
I have requirement where I have 4 columns in flat file.
Column names are P,Q,X,Y
in column X I have 3 diff value for records say A,B,C
Now Lets say there are 100 records in file , My output should be look like this
sanranad,
Here's the code if you wanted to group by column's P, Q and X (not just column X as you requested) if your input file should have different values for column P and Q as well. The output from this does not inlcude the 4th column Y from the input file which I assume you don't want since it's not in your output file example (again, need to post sample input file).
awk -F'|' '{arr[$1 "|" $2 "|" $3]++} END {for (i in arr) print i"|"arr}' input.file