0

in /etc/services file I can see duplicate lines

for example

the following line is duplicate ( or more )

odasrv         2432/udp

so it can easily deleted by sed as the follwing

  sed  -i '/codasrv         2432\/udp/d' /etc/services

but the problem is that sed delete all this duplicate lines

so what I need to change in the sed syntax

in order to delete all duplicate lines except the first one ?

chicks
  • 3,793
  • 10
  • 27
  • 36
shalom
  • 461
  • 13
  • 29
  • 4
    `man uniq`. https://stackoverflow.com/questions/1444406/how-can-i-delete-duplicate-lines-in-a-file-in-unix – Sven Aug 06 '18 at 17:09
  • I want to delete line according to specific request , I not want to delete all duplicate lines , second thing the empty lines in the file must be saved as is without deletion empty lines , – shalom Aug 06 '18 at 17:14
  • 1
    https://stackoverflow.com/questions/1444406/how-can-i-delete-duplicate-lines-in-a-file-in-unix and use `sed -i` to edit the file inplace. – Thomas Aug 06 '18 at 18:25

0 Answers0