Page 1 of 1

ignoring lines with certain content

Posted: Mon Jun 07, 2010 1:42 pm
by BillG
Hi,

I have a situation where I am comparing a bunch of text files and I want to ignore lines containing certain text strings. Also, perhaps ignore the first N lines of the file. I suppose there must be a simple RegEx answer to this, but so far it eludes me. For instance, I want to ignore lines that contain:

"CK SUM:"
"DIRECTORY:"

and possibly another 5 to 10 character strings. Any help greatly appreciated.

TIA,

Bill

Re: ignoring lines with certain content

Posted: Mon Jun 07, 2010 7:46 pm
by psguru
Hi Bill,
For instance, I want to ignore lines that contain:

"CK SUM:"
"DIRECTORY:"

and possibly another 5 to 10 character strings.
For this purpose you could use a regular expression like:

Code: Select all

CK SUM\:|DIRECTORY\:
To add more strings to the regular expression, simply add the strings (escaping all necessary characters) and separate them all with | operators.
Also, perhaps ignore the first N lines of the file.
Unfortunately, this is not possible with regular expressions.

Regards,

psguru

Re: ignoring lines with certain content

Posted: Mon Jun 07, 2010 10:42 pm
by tofuse
The problem that you are facing here is that examdiff pro run your regex in line by line mode.
What you are asking for is a multiline functionality where an expression like below would ignore a complete C# documentation tag. This is as stated earlier not possible. If you have multiple rows that you want to ignore you need to ignore them one by one. Unfortunately this means that you can't ignore a line depending on the contents of an earlier line.

^[ \t]*/// <summary>(?:[^/]*/)*?// </summary>[^\n]*\n

Re: ignoring lines with certain content

Posted: Tue Jun 08, 2010 2:32 am
by BillG
Thanks psguru,

A follow-up detail. I assume the RegEx's go into the Text Comparison Options/Ignore parts of each line?

TIA,

Bill

Re: ignoring lines with certain content

Posted: Tue Jun 08, 2010 6:32 am
by psguru
A follow-up detail. I assume the RegEx's go into the Text Comparison Options/Ignore parts of each line?
No, this is for Options | Compare | Ignore lines matching regular expression.

Re: ignoring lines with certain content

Posted: Tue Jun 08, 2010 6:35 am
by psguru
tofuse wrote:The problem that you are facing here is that examdiff pro run your regex in line by line mode.
This is actually incorrect. EDPro can use multiline regexes as "comments". See Options | Document Types. There you can define a type with its "comment" to ignore, which is just a multiline regex (can be a single line as a special case, of course).

Re: ignoring lines with certain content

Posted: Wed Jun 23, 2010 11:43 pm
by AlexL
BillG wrote:...ignore the first N lines of the file...
For this you should pass your files through a command line Unix-like command:

Code: Select all

tail +3 YourFile.txt
will output your file from line 3 (skipping first two lines). If you manage to organize the command above as a filter (or write such filter in, say, Perl), you will be able to skip first N lines in ExamDiff Pro.