This forum has been archived. All content is frozen. Please use KDE Discuss instead.

how to use kfilereplace to delete character strings?

Tags: None
(comma "," separated)
fraxinus
Registered Member
Posts
36
Karma
0
OS
I have a large directory of html files, from which I need to remove particular characters and path information. I am struggling a bit with kfilereplace. It is easy for me to get it to replace a character string with another - but I cannot work out how to get it to just delete a string from all of my files.

Can anyone help - or recommend a different package that I could try? Thanks in anticipation.
User avatar
TheBlackCat
Registered Member
Posts
2945
Karma
8
OS
Can't you replace it with an empty string?


Man is the lowest-cost, 150-pound, nonlinear, all-purpose computer system which can be mass-produced by unskilled labor.
-NASA in 1965
fraxinus
Registered Member
Posts
36
Karma
0
OS
TheBlackCat wrote:Can't you replace it with an empty string?

Thanks for your reply!

No, I cannot work out how to do this. In the 'Search and replace in files' dialogue I can enter the string I want to find in the 'Search' box - and kfilereplace will find it. However, if I leave the 'Replace' box blank, the program will take no action. In fact the 'Replace' option in the main program window stays greyed out.

Is there another character or expression that I need to insert into the 'Replace' box if I want a string just to be deleted, rather than replaced by another string?
User avatar
google01103
Manager
Posts
6668
Karma
25
there's an old bug report regarding this https://bugs.kde.org/show_bug.cgi?id=124626, voting for it couldn't hurt

you should be able to do this using find and grep or sed, Google'ing will get you various solutions

A couple of things I found that should do this that are gui based
- Jedit - http:/jedit.org "Multiple file search and replace; search in either the current file, all open files, or all files in a directory"
- FAR - http:/findandreplace.sourceforge.net "FAR is a simple tool for search and replace operations over multiple files"

too bad Kate doesn't seem to allow this


OpenSuse Leap 42.1 x64, Plasma 5.x

fraxinus
Registered Member
Posts
36
Karma
0
OS
google01103 wrote:there's an old bug report regarding this https://bugs.kde.org/show_bug.cgi?id=124626, voting for it couldn't hurt

you should be able to do this using find and grep or sed, Google'ing will get you various solutions

A couple of things I found that should do this that are gui based
- Jedit - http:/jedit.org "Multiple file search and replace; search in either the current file, all open files, or all files in a directory"
- FAR - http:/findandreplace.sourceforge.net "FAR is a simple tool for search and replace operations over multiple files"

too bad Kate doesn't seem to allow this

Thanks very much for your advice. I am seeking a GUI method, as I want a solution that will not terrify colleagues who have no experience of the command line! I'll take a look at Jedit and FAR.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
You might also want to look at KWrite/Kate which can perform find/replace (and do support replacing it with a blank, i've done it before)


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], q.ignora, watchstar