|
|
|
@ -16,9 +16,12 @@ func Fail(err error, format string, v ...any) { |
|
|
|
|
|
|
|
|
|
func main() { |
|
|
|
|
var number bool |
|
|
|
|
var squeeze bool |
|
|
|
|
|
|
|
|
|
flag.BoolVar(&number, "n", false, "Number all nonempty output lines, starting with 1") |
|
|
|
|
flag.BoolVar(&number, "number", false, "Number all nonempty output lines, starting with 1") |
|
|
|
|
flag.BoolVar(&squeeze, "s", false, "Suppress repeated adjacnet blank lines") |
|
|
|
|
flag.BoolVar(&squeeze, "squeeze-blank", false, "Suppress repeated adjacnet blank lines") |
|
|
|
|
flag.Parse() |
|
|
|
|
|
|
|
|
|
if flag.NArg() < 1 { |
|
|
|
@ -34,6 +37,10 @@ func main() { |
|
|
|
|
if(number) { |
|
|
|
|
count := 1 |
|
|
|
|
for line := range strings.Lines(string(in_file)) { |
|
|
|
|
if squeeze && len(line) <= 1 { |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fmt.Printf("%0.4d: %s", count, line) |
|
|
|
|
count++ |
|
|
|
|
} |
|
|
|
|