filters.go
func UniqWithCount() Filter {
	return FilterFunc(func(arg Arg) error {
		current := ""
		count := 0
		for s := range arg.In {
			if s != current {
				if count > 0 {
					arg.Out <- fmt.Sprintf("%d %s", count, current)
				}
				count = 0
				current = s
			}
			count++
		}
		if count > 0 {
			arg.Out <- fmt.Sprintf("%d %s", count, current)
		}
		return nil
	})
}
func UniqWithCount() Filter {
	return FilterFunc(func(arg Arg) error {
		current := ""
		count := 0
		for s := range arg.In {
			if s != current {
				if count > 0 {
					arg.Out <- fmt.Sprintf("%d %s", count, current)
				}
				count = 0
				current = s
			}
			count++
		}
		if count > 0 {
			arg.Out <- fmt.Sprintf("%d %s", count, current)
		}
		return nil
	})
}
func UniqWithCount ( ) Filter { return FilterFunc ( func ( arg Arg ) error { current := " " count := 0 for s := range arg . In { if s != current { if count > 0 { arg . Out <- fmt . Sprintf ( " " , count , current ) } count = 0 current = s } count ++ } if count > 0 { arg . Out <- fmt . Sprintf ( " " , count , current ) } return nil } ) }
// UniqWithCount squashes adjacent identical items in arg.In into a single
// output prefixed with the count of identical items followed by a space.
UniqWithCount squashes adjacent identical items in arg . In into a single output prefixed with the count of identical items followed by a space .