-2

I try to ignore lines matching following regex by sed command with kdiff3 when comparing files:

sed 's/^\*\*.*//g'

Sed command works in command line (it deletes lines starting with **), but when used in kdiff3 it completely ignores the command - lines with pattern are still present and not ignored.

Troubleshooting measures:

  • Tried changing ' to " in sed command - no effect
  • Tried simpler substitutions without any regex - no effect
  • Tried to use perl instead of sed (perl -p -e 's/\*.*//g') - no effect.

I'm using RedHat Linux, and kdiff version is 0.9.97

Example of input:

*** Timestamp 2017-05-31 03:00:13.159 ***
*** Extremity direction existence as dashwoods do up. Securing marianne led welcomed offended but offering ***
six raptures. Conveying concluded newspaper rapturous oh at. Two indeed suffer saw beyond far former

*** Timestamp 2017-05-31 03:00:13.585 ***
*** Conveying concluded newspaper rapturous oh at. Two indeed suffer saw beyond far former reasonably ***
Tiled say decay spoil now walls meant house. My mr interest thoughts screened of outweigh removing. Evening society musical besides inhabit ye my. Lose hill well up will he over on. Increasing sufficient

Output after using sed in terminal:

six raptures. Conveying concluded newspaper rapturous oh at. Two indeed suffer saw beyond far former

Tiled say decay spoil now walls meant house. My mr interest thoughts screened of outweigh removing. Evening society musical besides inhabit ye my. Lose hill well up will he over on. Increasing sufficient

Configuration in kdiff3

mtraton
  • 179
  • 1
  • 8

2 Answers2

0

Try using grep as stated below in your Preprocessor Command:

 grep "^[^*]"
tale852150
  • 1,618
  • 3
  • 17
  • 23
  • It does not work. However, if I use sed or grep in preprocessor command, it works normally - lines are deleted. I thought that kdiff3 could provide to print lines matching pattern but not consider them when calculating diff. Maybe I misunderstand how line matching pre-processor command works. – mtraton Jun 01 '17 at 05:58
  • @mtraton - why don't you just use the preprocessor command and not the line matching pre-processor command? – tale852150 Jun 01 '17 at 15:30
  • I'm using it now, but I looked for some diff app that can ignore lines during line matching and still be able to see them - in this case to be able to see timestamps in log files. – mtraton Jun 01 '17 at 17:01
  • @mtraton - might be easier to write a Perl script to do that -- to ignore but not delete lines, in your case with leading *** characters. – tale852150 Jun 01 '17 at 17:26
0

I didn't manage to ignore those lines using kdiff, but meld does it just fine with following regex \*\*.*. I hope that helps someone who's looking for same functionality :)

mtraton
  • 179
  • 1
  • 8