To-Slalom

grep test

May 17th, 2021 (edited)
685
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.35 KB | None | 0 0
  1. grep.txt
  2.  
  3. Hello, how are you
  4. I am grep
  5. Nice to meet you
  6. Comment[zh_CN]=Zarfy Multiple Screens # want this line
  7. whateverComment[zh_CN]=Zarfy Multiple Screens # and not this one
  8.  
  9. grep.sh
  10.  
  11. #!/bin/sh
  12.  
  13. code='[zh_CN]';
  14. grep  "^Comment${code}*" grep.txt                   # both give me 2 lines
  15. grep -F "Comment$code" | grep '^Comment' grep.txt   # both give me 2 lines
  16.  
Add Comment
Please, Sign In to add comment