This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

problem with diff -I 'regexp'


Hello :
My problem : I'd like to ignore the lines beginning with --
$ diff -I '^--' test1.txt test2.txt
1,3c1,3
< 1when
< --I want ?
< #ok nok
---
> 2when
> --I want
> #ok
5,6c5,6
< 2
< 3
---
> 4
> 5
8c8
< test 2
---
> test x

The lines are in the output, why ? I obtain the same thig with the following
similar commands :
$ diff -I '^#' test1.txt test2.txt
$ diff -I 'want' test1.txt test2.txt
Why the regular expression is ignore?

The input files :
test1.txt
1when
--I want ?
#ok nok
#end of comment
2
3
test 1
test 2

test2.txt
1when
--I want
#ok nok
#end of comment
2
3
test 1
test 2


A normal command produces :
$ diff test1.txt test2.txt
1,3c1,3
< 1when
< --I want ?
< #ok nok
---
> 2when
> --I want
> #ok
5,6c5,6
< 2
< 3
---
> 4
> 5
8c8
< test 2
---
> test x

An ignore option that runs (line 5 and 6 of the following disappear, that's
ok):
$ diff -I '^[[:digit:]]' test1.txt test2.txt
1,3c1,3
< 1when
< --I want ?
< #ok nok
---
> 2when
> --I want
> #ok
8c8
< test 2
---
> test x

Philippe Le Dréau



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]