Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -n
- # cat /etc/passwd | pipe-rx-count root
- # root:x:0:0:root:/root:/bin/bash
- # showing 1 of 57 lines
- BEGIN{
- $pat=shift;
- }
- $n++;
- /$pat/ && print && $m++;
- END{
- warn "showing ", $m, " of ", $n, " line", ($n==1?"":"s"), "\n"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement