-F

Aug. 8th, 2011 08:55 am
ocehb: (Default)
[personal profile] ocehb
Есть файл типа

ERD_Sovetsk_22 Power: OK
ERD_Lenina_31 Power: PROBLEM
ERD_Svobody_1 Power: OK
Kommynist_33 is access: PROBLEM
ERD_Sovetsk_100 Power: PROBLEM
ERD_Partizan_98 Power: PROBLEM
Marksa_4 is access: PROBLEM
Revolucii_67 is access: PROBLEM
Marksa_4 is access: PROBLEM
Revolucii_67 is access: OK

Раскидать значения по статусу.


однострочник:

# perl -aF":\\s+" -lne 'push @{$a{$F[1]}}, $F[0];
  END{ print STDERR "PROBLEM: ", join ",", @{$a{PROBLEM}};
       print "OK: ", join ",", @{$a{OK}}; }' file


основную работу делает -aF":\\s+" и push, которые делят входящие строки и распихивают их по статусу в %a.


:)
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

Profile

ocehb: (Default)
ocehb

January 2021

S M T W T F S
     12
345 6789
10111213141516
17181920212223
24252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 6th, 2026 04:33 am
Powered by Dreamwidth Studios