Advertisement
Guest User

funny grep behaviour, debian grep 2.12-2

a guest
Jan 21st, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1.  
  2. Sorry, I had to edit lightly to remove some info. But the gist remains - seems only the 2nd and later matches (or similar rule) in the file skip a line of context.
  3.  
  4. I note that the second alternative in the regex is the one that has its context properly reported ... not sure if that is significant.
  5.  
  6. But, egrep worked properly. Only grep shows this behaviour.
  7.  
  8.  
  9.  
  10. $ grep -n -A 2 'ClassID=\|provides' *.xml | grep -v -- '</' | less
  11.  
  12.  
  13. Alias.xml:3: provides="Alias">
  14. Alias.xml-4-<!-- XXX -->
  15. Alias.xml-5- <dataTypeDefs>
  16. --
  17. Alias.xml:27: <ClassDef ClassID="114">
  18. Alias.xml-29- <synopsis>
  19. --
  20. AllTypes.xml:3: provides="AllTypes">
  21. AllTypes.xml-4- <dataTypeDefs>
  22. AllTypes.xml-5- <dataTypeDef>
  23. --
  24. AllTypes.xml:102: <ClassDef ClassID="116">
  25. AllTypes.xml-104- <synopsis>
  26. --
  27. AllTypes.xml:186: <ClassDef ClassID="117">
  28. AllTypes.xml-188- <synopsis>
  29. --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement