2021年4月29日星期四

Count rows in unix file excluding multiple headers and trailer

My file has multiple headers/trailers. I need to find row count excluding the headers/trailers.

Sample File is like:

02H1

01H2

0002Rec1

0002Rec2

00H2

0003Rec1

0003Rec2

0003Rec3

T1

T2

Expected Output:

Count of all detail record = 5 (i.e substr($0,2,2) <> H1,H2 and substr($0,0,2) <> T1,T2 )

Count of 0002 = 2

Count of 0003 = 3

https://stackoverflow.com/questions/67327045/count-rows-in-unix-file-excluding-multiple-headers-and-trailer April 30, 2021 at 09:24AM

没有评论:

发表评论