<commit_before>// go build -o gogrep
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strings"
)

func main() {
	if len(os.Args) < 3 {
		fatal(2, "Usage: %s <pattern> <file>\n", os.Args[0])
	}

	pat := os.Args[1]
	file := os.Args[2]

	cnt, err := printMatchingLines(os.Stdout, pat, file)
	if err != nil {
		fatal(2, err.Error())
	}

	if cnt > 0 {
		os.Exit(0)
	} else {
		os.Exit(1)
	}
}

func fatal(exitVal int, msg string, args ...interface{}) {
	fmt.Fprintf(os.Stderr, msg, args...)
	os.Exit(exitVal)
}

func printMatchingLines(out io.Writer, pat string, file string) (int, error) {<commit_msg>inlined unneeded fatal() function<commit_after>// go build -o gogrep
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strings"
)

func main() {
	if len(os.Args) < 3 {
		fmt.Fprintf(os.Stderr, "Usage: %s <pattern> <file>\n", os.Args[0])
		os.Exit(2)
	}

	pat := os.Args[1]
	file := os.Args[2]

	cnt, err := printMatchingLines(os.Stdout, pat, file)
	if err != nil {
		fmt.Fprintf(os.Stderr, err.Error())
		os.Exit(2)
	}

	if cnt > 0 {
		os.Exit(0)
	} else {
		os.Exit(1)
	}
}

func printMatchingLines(out io.Writer, pat string, file string) (int, error) {
{'fraction_non_alphanumeric': 0.18911917098445596, 'fraction_numerical': 0.015544041450777202, 'mean_word_length': 3.3408239700374533, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6084105', 'n_tokens_mistral': 532, 'n_tokens_neox': 510, 'n_words': 122}