Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. ---
  2. title: dont't know
  3. draft: true
  4. ---
  5. this is a test to add some extra content
  6.  
  7. this is a test to add some extra content
  8.  
  9. $ cat test.info | grep '---' -A1
  10. grep: unrecognized option `---'
  11.  
  12. $ cat test.info | grep 'this' -A1
  13.  
  14. $ grep -m 1 -e '---' test.info
  15. ---
  16. $ grep -- --- test.info | tail -1
  17. ---
  18.  
  19. if $line 'not numeric' ...
  20.  
  21. $ grep --version
  22.  
  23. grep -e "---" test.info
  24.  
  25. grep "---" test.info
  26.  
  27. tac file| awk '/---/ {exit} {print}'|tac
  28.  
  29. tac file
  30.  
  31. next line
  32. this is a test to add some extra content
  33. ---
  34. draft: true
  35. title: dont't know
  36. ---
  37.  
  38. next line
  39. this is a test to add some extra content
  40.  
  41. this is a test to add some extra content
  42. next line
  43.  
  44. $ cat t3.info
  45. ,,,
  46. qwerty
  47. uiop
  48. ,,,
  49.  
  50.  
  51.  
  52.  
  53. werwer
  54. werwer
  55. ,,,,,
  56. werwerwer
  57. werwerwer
  58. werwerwer
  59. ,,,,
  60.  
  61.  
  62.  
  63. $ cat t3.info | grep -P ',,,' -A1
  64. ,,,
  65. qwerty
  66. --
  67. ,,,
  68.  
  69. --
  70. ,,,,,
  71. werwerwer
  72. --
  73. ,,,,
  74.  
  75.  
  76.  
  77. $
  78.  
  79. $ cat t3.info
  80. ---
  81. qwerty
  82. uiop
  83. ---
  84.  
  85.  
  86.  
  87.  
  88. werwer
  89. werwer
  90. ---
  91. werwerwer
  92. werwerwer
  93. werwerwer
  94. ---
  95.  
  96. $ cat t3.info | grep -P '---' -A1
  97. ---
  98. qwerty
  99. --
  100. ---
  101.  
  102. --
  103. ---
  104. werwerwer
  105. --
  106. ---
  107.  
  108. $ cat t3.info | grep -P '(?=x2d{3})...' -A1
  109. ---
  110. qwerty
  111. --
  112. ---
  113.  
  114. --
  115. ---
  116. werwerwer
  117. --
  118. ---
  119.  
  120. $ grep --version
  121. grep (GNU grep) 2.16
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement