Skip navigation.

Log in | Sign up

Linux for Designers

a blog by Eckhard M. Jäger

Comparing files using gEdit

, , , , , ,

At the moment i'm heavily on scripting various things and some times its needed to compare files. As a Winy i used PSPad which have an included comparsion tool. Now i'm on Linux using gEdit and i'd like to have such a nice workflow once i had using PSPad.
I found a very nice way using Meld. Meld is a graphical comparsion tool and will work very well as an external tool of gEdit:

1) Install the package "meld"
2) Start gEdit and opening the Menu "Tools > External Tools..."
3) Add a new external tool:
* Name: Compare Files
* Description: Compare then opened file with another
* Command:
#!/bin/sh 
meld $GEDIT_CURRENT_DOCUMENT_DIR/$GEDIT_CURRENT_DOCUMENT_NAME `zenity --file-selection --title=File for comparsion --filename=/home/` &
* Any othe roption is not interesting so press close
4) Now you have in "Tools" an menu entry "Compare Files" that will use the active document of gEdit and the other browsed file for comparsion

Happy computing :smile:

GREYCstoration 2.9 plugin for GimpGimp2CSS

Comments

avatar
angelys writes:

Hello,

I have meld installed.

I have an error :

/bin/sh: Can't open meld $GEDIT_CURRENT_DOCUMENT_DIR/$GEDIT_CURRENT_DOCUMENT_NAME `zenity --file-selection --title=Datei zum vergleichen

Exited: 512

Strange ?

By anonymous user, # 16. June 2008, 14:23:30

avatar
What kind Linux distribution? Is Zenity installed? Is you eternal tool command really

#!/bin/sh

meld $GEDIT_CURRENT_DOCUMENT_DIR/$GEDIT_CURRENT_DOCUMENT_NAME `zenity --file-selection --title=Datei zum vergleichen auswählen --filename=/home/` &

?

What happens when you try to start meld /path/to/file.txt /path/to/another/file.txt at the shell?

By area42, # 16. June 2008, 18:54:14

avatar
angelys writes:

Sorry, i have put all on the same line :


#!/bin/sh meld $GEDIT_CURRENT_...



I'm under ubuntu hardy 64.
Zenity is installed (under gnome).
When i try to start meld @ the shell, all is working fine...


I have two css files opened in gedit and when i run the script, meld opens with an error > invalid arguments received > 4




By anonymous user, # 16. June 2008, 20:11:22

avatar
Hi,

at the first tries i get the same errors. Make sure that there are spaces just after meld, after $GEDIT_CURRENT_DOCUMENT_NAME and after ... home/`. Any space between will accept Meld as the next file.

By area42, # 17. June 2008, 07:55:12

avatar
angelys writes:

It does not work.
But I will try to correct the problem.

For now, I especially look forward to seeing to see CSSdev :smile:

Thank you very much for your great job

By anonymous user, # 18. June 2008, 11:57:12

avatar
Giorgio Salluzzo writes:

Right script to take care of filepath spaces:

#!/bin/sh
meld "$GEDIT_CURRENT_DOCUMENT_DIR/$GEDIT_CURRENT_DOCUMENT_NAME" "`zenity --file-selection --title=File for comparsion --filename=/home/`" &

By anonymous user, # 31. July 2008, 14:02:07

avatar
@Giorgio

"" <- is a good idea :smile: Thanx.

By area42, # 31. July 2008, 15:25:18

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

Please type this security code : 8e94d3

Smilies