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

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -