easy string replacement

Here you can exchange scripts that you created or have permission to share with other users.
Post Reply
Message
Author
User avatar
Jerry3904
Administrator
Posts: 21881
Joined: Wed Jul 19, 2006 6:13 am

easy string replacement

#1 Post by Jerry3904 »

I needed to change one string in all the conkies, and didn't want to open the scripts one at a time. Googled the problem as "bash replace string many files," and came upon a description on how to use the Debian package rpl.

Installed that, opened a terminal in ~/.conky, and ran this after reading the man page:

Code: Select all

rpl -R "override_utf8_locale no" "override_utf8_locale yes" MX-*
--the -R tells the program to run recursively so it will cover all subfolders
--I had to use quotes around the string I wanted to replace (I read) because it contained a space
--All our conkies start with the same prefix (after I made a few changes...), so I could use MX-* to include them.

That appears to have worked just fine, and is much easier for me than figuring out the syntax of sed, the command that is usually recommended.
Production: 5.10, MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB
Personal: Lenovo X1 Carbon with MX-23 Fluxbox and Windows 10
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin

User avatar
cyrilus31
Posts: 629
Joined: Thu Nov 03, 2016 3:24 pm

Re: easy string replacement

#2 Post by cyrilus31 »

It's great that you succeded Jerry :number1:

How many conky themes do you intend to provide out of the box?

User avatar
Jerry3904
Administrator
Posts: 21881
Joined: Wed Jul 19, 2006 6:13 am

Re: easy string replacement

#3 Post by Jerry3904 »

Just trying now to correct the B2 collection, and will probably eliminate a few for Final.

The goal was to set up conky out of the box, develop a tool to make modifications easier, and to provide decent documentation. That has been mostly done now.
Production: 5.10, MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB
Personal: Lenovo X1 Carbon with MX-23 Fluxbox and Windows 10
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin

User avatar
Stevo
Developer
Posts: 12774
Joined: Fri Dec 15, 2006 8:07 pm

Re: easy string replacement

#4 Post by Stevo »

Re: rpl viewtopic.php?f=86&t=43063&p=424292&hilit=rpl#p424292 :happy:

Yes, it is quite useful and powerful!

User avatar
Jerry3904
Administrator
Posts: 21881
Joined: Wed Jul 19, 2006 6:13 am

Re: easy string replacement

#5 Post by Jerry3904 »

Oh sorry, that message was buried in a thread and I never saw it.
Production: 5.10, MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB
Personal: Lenovo X1 Carbon with MX-23 Fluxbox and Windows 10
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin

Post Reply

Return to “Scripts”