File: diff-remove-file-ids

package info (click to toggle)
bro 2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 78,640 kB
  • sloc: ansic: 126,302; cpp: 95,205; yacc: 2,528; lex: 1,819; sh: 793; python: 700; makefile: 134
file content (34 lines) | stat: -rwxr-xr-x 551 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /usr/bin/env bash
#
# A diff canonifier that removes all file IDs from files.log

awk '
BEGIN {
    FS="\t";
    OFS="\t";
    process = 0;
    }

$1 == "#path" && $2 == "files" {
    process = 1;
    }

/^[^#]/ {
    if ( process && column1 > 0 && column2 > 0 ) {
        $column1 = "XXXXXXXXXXX";
        $column2 = "XXXXXXXXXXX";
        }
    }

/^#fields/ {
    for ( i = 2; i <= NF; ++i ) {
        if ( $i == "fuid" )
            column1 = i - 1;

        if ( $i == "parent_fuid" )
            column2 = i - 1;
        }
    }

{ print }
'