sed - compare first 60 characters and delete the duplicate row -


How to use sed to test continuously lines, where the first 10 characters are the same? If same, then the second line of rows will be removed.

Example:

Before

  ABCDEF123456 123456ABCDEF 123456789012 123456789090  

after

< Pre> ABCDEF 123456 123456 ABCDEF 123456789012

This work for you (GNU SAD):

  sed 'n'; P; / ^ \ (. \ {10 \} \). * \ N \ 1 / d; D 'file  

Read two rows, print first and then compare the first ten letters of the first line with the second line if they are equal, then delete the two rows or else delete them first Please give it.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -