scripting - awk + remove all not uniq lines except the first line uniq (FILE NAME) -


Hello, I have the following file, How do I remove all FILE NAME rows except for the first uniq FILE NAME? All file name lines:

  file name: / dir1 / dir2 / dir3 / dir4 / dir5 / file file name: / Dira / dirB / dirC / dirD / hard / file  < / Pre> 

file:

  file name: / dir1 / dir2 / dir3 / dir4 / dir5 / file parameter name: blablabla target file: 12 source file: 565 file name: / dir1 / Dir2 / dir3 / dir4 / dir5 / file parameter name: blablabla target File: 18 source file: 552 file name: / dir1 / dir2 / dir3 / dir4 / dir5 / file parameter name: blablabla target file: 14 source file: 559 file name: / dira / dirb / dirc / dird / string / file parameter Name: blablabla target file: 134 source file: 344 file name: / Dira / dirB / dirc / dirD / string / file parameter name: blablabla target file: 13 source file: 445 file name: / dira / dirb / dirc / dird / Strict / File parameter name: blablabla target file: 13 source file: 434  

if you Sir If you want the rows samples of two rows of unique file listed names shown by the

grep "^ FILE NAME" input.txt | Sort | Uniq


Update:
I'm not sure what you really want.
the sort | Uniq filter will bring you all the unique path names in all the rows starting with "FILENAME NAME" . If your sample input and output is not correct, then you want to correct it with the edit button.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -