Welcome!

Please read this important information about MX sources lists.
News
  • MX Linux on social media: here
  • Mepis support still here
Current releases
  • MX-17 Final release info here
  • MX-16.1 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!
    • Read Forum Rules

easy string replacement

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

easy string replacement

#1 Postby 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.7.0-0.bpo.1-amd64, MX-15 RC1, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 8 GB, Kingston SSD 120 GB and WesternDigital 1TB
Testing: AAO 722: 3.16-0-4-686-pae. MX-15, AMD C-60 APU, 4 GB

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

Re: easy string replacement

#2 Postby 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: 20070
Joined: Wed Jul 19, 2006 6:13 am

Re: easy string replacement

#3 Postby 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.7.0-0.bpo.1-amd64, MX-15 RC1, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 8 GB, Kingston SSD 120 GB and WesternDigital 1TB
Testing: AAO 722: 3.16-0-4-686-pae. MX-15, AMD C-60 APU, 4 GB

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

Re: easy string replacement

#4 Postby 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: 20070
Joined: Wed Jul 19, 2006 6:13 am

Re: easy string replacement

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

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


Return to “Scripts”

Who is online

Users browsing this forum: No registered users and 2 guests