Welcome!
Important information
-- Spectre and Meltdown vulnerabilities
-- Change in MX sources

News
-- MX Linux on social media: here
-- Mepis support still here

Current releases
-- MX-17.1 Final release info here
-- antiX-17 release info here

New users
-- Please read this first, and don't forget to add system and hardware information to posts!
-- Here are the Forum Rules

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
Forum Veteran
Forum Veteran
Posts: 21918
Joined: Wed Jul 19, 2006 6:13 am

easy string replacement

#1 Post by Jerry3904 » Wed Nov 22, 2017 9:06 am

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: 4.15.0-1-amd64, MX-17.1, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 8 GB, Kingston SSD 120 GB and WesternDigital 1TB
Testing: AAO 722: 4.15.0-1-386. MX-17.1, AMD C-60 APU, 4 GB

User avatar
cyrilus31
Forum Regular
Forum Regular
Posts: 546
Joined: Thu Nov 03, 2016 3:24 pm

Re: easy string replacement

#2 Post by cyrilus31 » Wed Nov 22, 2017 9:32 am

It's great that you succeded Jerry :number1:

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

User avatar
Jerry3904
Forum Veteran
Forum Veteran
Posts: 21918
Joined: Wed Jul 19, 2006 6:13 am

Re: easy string replacement

#3 Post by Jerry3904 » Wed Nov 22, 2017 9:52 am

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: 4.15.0-1-amd64, MX-17.1, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 8 GB, Kingston SSD 120 GB and WesternDigital 1TB
Testing: AAO 722: 4.15.0-1-386. MX-17.1, AMD C-60 APU, 4 GB

User avatar
Stevo
Forum Veteran
Forum Veteran
Posts: 15793
Joined: Fri Dec 15, 2006 8:07 pm

Re: easy string replacement

#4 Post by Stevo » Wed Nov 22, 2017 4:15 pm

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

Yes, it is quite useful and powerful!

User avatar
Jerry3904
Forum Veteran
Forum Veteran
Posts: 21918
Joined: Wed Jul 19, 2006 6:13 am

Re: easy string replacement

#5 Post by Jerry3904 » Wed Nov 22, 2017 5:08 pm

Oh sorry, that message was buried in a thread and I never saw it.
Production: 4.15.0-1-amd64, MX-17.1, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 8 GB, Kingston SSD 120 GB and WesternDigital 1TB
Testing: AAO 722: 4.15.0-1-386. MX-17.1, AMD C-60 APU, 4 GB

Post Reply

Return to “Scripts”