Skip to main content
2 of 2
added output formatting
steeldriver
  • 83.9k
  • 12
  • 124
  • 175
$ awk -F"/" '!seen[$1]++ {print $1}' findint.txt 
Eth1
Eth101
Eth103
Gi0

To get the output all in one comma-separated line, you could set the output separator ORS to , however you'd need to make a special case for the the last value; a simpler way is to pipe the output of awk to paste:

awk -F"/" '!seen[$1]++ {print $1}' findint.txt | paste -sd,
steeldriver
  • 83.9k
  • 12
  • 124
  • 175