Advertisement
vadipp

Magic BSD grep

Nov 16th, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. # Let's start with the good old debian
  2. root@debian:~# echo -e 'hello\ntest\ntest test' | grep '.*\s.*'
  3. test test
  4. root@debian:~# echo -e 'hello\ntest\ntest test' | grep '\s'
  5. test test
  6.  
  7. # So far so good, let's switch to the FreeBSD box
  8. [root@freebsd ~]# echo -e 'hello\ntest\ntest test' | grep '.*\s.*'
  9. test test
  10. [root@freebsd ~]# echo -e 'hello\ntest\ntest test' | grep '\s'
  11. test
  12. test test
  13.  
  14. # Wtf is that 'test' match in the last command? Looks as if it matches plain 's' in this case.
  15. # Lets try some switches. According to the man, the sensible ones are only -P, -F and -E, but -P is not supported
  16. [root@freebsd ~]# echo -e 'hello\ntest\ntest test' | grep -P '\s'
  17. grep: The -P option is not supported
  18. [root@freebsd ~]# echo -e 'hello\ntest\ntest test' | grep -E '\s'
  19. test
  20. test test
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement