Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. #!/usr/bin/perl -n
  2. # cat /etc/passwd | pipe-rx-count root
  3. # root:x:0:0:root:/root:/bin/bash
  4. # showing 1 of 57 lines
  5. BEGIN{
  6. $pat=shift;
  7. }
  8.  
  9. $n++;
  10.  
  11. /$pat/ && print && $m++;
  12.  
  13. END{
  14. warn "showing ", $m, " of ", $n, " line", ($n==1?"":"s"), "\n"
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement