Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 29 Jul 2014, 15:24
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Filesystem
Turma2 - Gtk2 search & replace tool
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [10 Posts]  
Author Message
muggins

Joined: 20 Jan 2006
Posts: 6673
Location: lisbon

PostPosted: Fri 13 May 2011, 01:16    Post subject:  Turma2 - Gtk2 search & replace tool  

https://launchpad.net/turma2



Quote:
Utility for searching for and, optionally, replacing strings in both text and binary files. This is a fork of original turma project located at: http://turma.sourceforge.net/software/turma/index.html This fork was made after decision to remove obsolete GTK1 libraries from the AUSTRUMI linux distribution. Seems like original project authors is not supporting it anymore.


Run via Menu>Filesystem>Turma2
turma2-0.3.1.pet
Description 
pet

 Download 
Filename  turma2-0.3.1.pet 
Filesize  41.81 KB 
Downloaded  430 Time(s) 
Back to top
View user's profile Send private message 
Geoffrey


Joined: 30 May 2010
Posts: 1327
Location: Queensland Australia ɹǝpu∩uʍop

PostPosted: Sat 14 May 2011, 00:35    Post subject:  

I get this error
Code:
# turma2
turma2: symbol lookup error: turma2: undefined symbol: gtk_info_bar_new

tried it on quirky 1.2.0 nop

Geoffrey
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4282

PostPosted: Sat 14 May 2011, 00:44    Post subject:  

Wow, extremely simple ...I may just add a frontend to my one-liner that I use for the same purpose .... I didn't realize there was a need. Brb.
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2225

PostPosted: Sat 14 May 2011, 04:56    Post subject:  

You can get the original GTK1 version here:
http://distro.ibiblio.org/pub/linux/distributions/amigolinux/download/Applications/Search/turma-0.1/
Back to top
View user's profile Send private message 
muggins

Joined: 20 Jan 2006
Posts: 6673
Location: lisbon

PostPosted: Sat 14 May 2011, 08:46    Post subject:  

Hello Geoffrey,

yes, it probably needs newer gtk2 version. I was unable to get it to compile with either p412 or p431. Or, if you install these:

glib12-1.2.10.pet (53k)
gtk+12-1.2.10.pet (522k)

then the gtk1 version of turma, that amigo mentions, should work. A .pet of the gtk1 version is here: turma.
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Sun 15 May 2011, 13:30    Post subject:  

muggins,

Thanks, this has a nice interface (much better than the original). I tried it in lupu510 and it worked except for the right-click on found items did not go to the folder.

technosaurus
Quote:
Wow, extremely simple ...I may just add a frontend to my one-liner that I use for the same purpose .... I didn't realize there was a need


That must be a real long one-liner Smile

Regards,
s
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4282

PostPosted: Mon 16 May 2011, 10:17    Post subject:  

seaside wrote:
That must be a real long one-liner Smile

not realy, here is a simplified version in script form
Code:
#!/bin/sh
find . -iname \*$3 -exec sed -i "s/"$1"/"$2"/g" {} ';' -print

$1 is what you want to replace
$2 is what you want to replace it with
$3 is the ending of a file (ex. akefile to get Makefile and makefile or .txt to only do text files)

if this is all you want to do, then find is not necessary (i just use simple shell commands to recurse all subdirectories) , but this way maybe someone can add it as an option to pfind if they'd like (which uses various other find parameters)

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Mon 16 May 2011, 18:15    Post subject:  

technosaurus wrote:

find . -iname \*$3 -exec sed -i "s/"$1"/"$2"/g" {} ';' -print[/code]

technosaurus,

Thanks that looks quite handy - I think I'll just make that a function and slip it into my .bashrc file.

My comfort level would be much higher with a typical "editor type" search and replace function across files. Enter a file pattern, find word, and replace word; then be presented with a window of grep-like line finds -
FILENAME *line-context...found-word....*
Here, you could individually-or multi-select lines and then do a "Replace ok, Skip, or Replace All".

Regards,
s
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4282

PostPosted: Mon 16 May 2011, 21:38    Post subject:  

That's pretty doable, just store the find results for the filenames separately, then use grep in a loop with sed to get the line numbers and replace (i don't know if busybox sed can be limited to a specific line though ... in case someone is using a pupngo puplet)
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Tue 17 May 2011, 20:32    Post subject:  

Here's a limited protype that just needs a front end.

Code:
#!/bin/sh

DIR=/etc
SEARCH=copyright
REPLACE=Copyright

#################

grep -R $SEARCH $DIR >/tmp/finds

while read -r line
    do
    Xdialog --center --title "Mutiple file search and replace"  --ok-label "Replace" --cancel-label "Skip" --combobox "Replace $SEARCH with $REPLACE"  800x100 "$line"
    RETVAL=$?
    if [ $RETVAL -eq 0 ]; then
      FN=`echo $line | cut -d: -f1 `
      sed -i "s/$SEARCH/$REPLACE/g" "$FN"
    fi
       
    if [ $RETVAL -eq 255 ]; then
      exit
    fi
done < /tmp/finds
 


This is probably better in Gtkdialog- at least you get more buttons there. Smile

Cheers,
s
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [10 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Filesystem
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0671s ][ Queries: 13 (0.0050s) ][ GZIP on ]