i have a log file containing modules and queries in this order:
com.ab
com.ab
com.ac
com.ad
com.ab
com.ac
com.ad
hence i used the following grep command to remove duplicates :
grep -m1 'com.a' filename
but it was not giving the correct output as i wanted the output to be such that it removes duplicates and also finds distinct pattern:
com.ab
com.ac
com.ad
how do i achieve the above output using grep
awk '!seen[$0]++' file.txtsort -u filename