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]

Re: Diff and grep problems


Hi Eric,

Thanks for the help. I'd already "man diff" and it doesn't read like it applies only to files, but info tells me more :

`-I REGEXP'
`--ignore-matching-lines=REGEXP'
     Ignore changes that just insert or delete lines that match REGEXP.
     *Note Specified Lines::.

However - this is a *changed* line, not an insert/delete so I don't think it will work. So my best guess is that I have to pre-grep the files involved. However this brings me onto the second problem, where grep seems to have the same issue (unless -f in grep ALSO only filters filenames..)


I've just tried the same setup using grep in Solaris, and I get the desired/expected results:

utrannis1 /home/amarsh> cat a.txt
a
b
c
d
e
utrannis1 /home/amarsh> cat b.txt
b
utrannis1 /home/amarsh>  /usr/xpg4/bin/grep -f b.txt a.txt
b

But when I try this same thing in cygwins version of grep, it fails (note the manual grep is ok).


C:\backups\__cisco_backups>cat c.txt
ntp

C:\backups\__cisco_backups>c:\cygwin\bin\grep -f c.txt a.txt

C:\backups\__cisco_backups>c:\cygwin\bin\grep ntp a.txt
ntp clock-period 17179955
ntp source Vlan135
ntp server 135.86.68.147



Eric Blake wrote:


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Adrian Marsh on 8/25/2005 3:52 AM:


I've trying to compare two files using diff from a .bat file :

diff -iX scripts/%2.ignorelist "%difffile1%" "%difffile2%"



...


So I wanted to exclude the ntp line and I put it in the ignorelist.



This is not cygwin specific. Read up on 'info diff' - the -X option is a file listing patterns of FILENAMES to ignore when diffing directories, not LINES to ignore within file pairs being diffed. Try -I instead.

- --
Life is short - so eat dessert first!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDDbes84KuGfSFAYARAhOMAKDE7oAK7J6ReXDHdcbvpXaR/+kbowCgjt+j
P5QS4RWZKeZGHF6Yr/TDedo=
=iSCz
-----END PGP SIGNATURE-----

--
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/




-- 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]