delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/10/15/05:57:53

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <A9C4AED47120D6119AFA00D0B7C84483028BED2D@Exchrouen.prosodie>
From: =?iso-8859-1?Q?Le_Dr=E9au_Philippe?= <pledreau AT prosodie DOT com>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: problem with diff -I 'regexp'
Date: Fri, 15 Oct 2004 12:00:42 +0200
MIME-Version: 1.0
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id i9F9vq6U013093

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/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019