Unique second column values
Jump to navigation
Jump to search
I just needed an overview which virtual hostnames where used from the access.log. As in my case the second column was filled with that information and I only wanted every single value once, that one liner did it:
cat access.log | cut -d' ' -f2 | sort -u
It seperates the line colmumns by a space character, gets the second one and makes a unique sort so every value is printed once.