The different extended pattern matching operators are listed below, where pattern-list is a list containing one or more filenames, separated using the | character:

  1. *(pattern-list) – matches zero or more occurrences of the specified patterns
  2. ?(pattern-list) – matches zero or one occurrence of the specified patterns
  3. +(pattern-list) – matches one or more occurrences of the specified patterns
  4. @(pattern-list) – matches one of the specified patterns
  5. !(pattern-list) – matches anything except one of the given patterns

To use them, enable the extglob shell option as follows:

# shopt -s extglob

1. To delete all files in a directory except filename, type the command below:

$ rm -v !("filename")
Delete All Files Except One File in Linux

2. To delete all files with the exception of filename1 and filename2:

$ rm -v !("filename1"|"filename2") 
Source: 3 Ways to Delete All Files in a Directory Except One or Few Files with Extensions

In bash scripting, the replacement of string is important because it allows you to modify a variable and the text of a file. It also helps in file and text processing and to validate user input.

To replace a string in bash, check the following methods:

  1. Using Parameter expansion: ${String/pattern/replacement}
  2. Using the sed command: sed 's/pattern/replacement/' filename
  3. Using the awk command: "input_str" | awk 'pattern { action }'
  4. Using the perl command: perl [options] -e 'action' filename
  5. Using the tr command: tr 'old_chars' 'new_chars' < "input_file"

Dive into the article to learn these methods of how to replace a bash string in detail.

Source: How to Replace String in Bash? [5 Methods] – LinuxSimply

Researchers Develop New Material That Converts CO2 into Methanol Using Sunlight

Posted by EditorDavid on Saturday March 30, 2024 @01:34PM from the fun-with-photocatalysis dept.

“Researchers have successfully transformed CO2 into methanol,” reports SciTechDaily, “by shining sunlight on single atoms of copper deposited on a light-activated material, a discovery that paves the way for creating new green fuels.” Tara LeMercier, a PhD student who carried out the experimental work at the University of Nottingham, School of Chemistry, said: “We measured the current generated by light and used it as a criterion to judge the quality of the catalyst. Even without copper, the new form of carbon nitride is 44 times more active than traditional carbon nitride. However, to our surprise, the addition of only 1 mg of copper per 1 g of carbon nitride quadrupled this efficiency. Most importantly the selectivity changed from methane, another greenhouse gas, to methanol, a valuable green fuel.”


Professor Andrei Khlobystov, School of Chemistry, University of Nottingham, said: “Carbon dioxide valorization holds the key for achieving the net-zero ambition of the UK. It is vitally important to ensure the sustainability of our catalyst materials for this important reaction. A big advantage of the new catalyst is that it consists of sustainable elements — carbon, nitrogen, and copper — all highly abundant on our planet.” This invention represents a significant step towards a deep understanding of photocatalytic materials in CO2 conversion. It opens a pathway for creating highly selective and tuneable catalysts where the desired product could be dialed up by controlling the catalyst at the nanoscale.

“The research has been published in the Sustainable Energy & Fuels journal of the Royal Society of Chemistry.”

Thanks to long-time Slashdot reader Baron_Yam for sharing the article.

From science.slashdot.org

Those are the good news we want to read!

Pare mi sia andata bene

sudo apt purge xz-utils 
[sudo] password di paolo: 
Lettura elenco dei pacchetti... Fatto
Generazione albero delle dipendenze... Fatto
Lettura informazioni sullo stato... Fatto   
I seguenti pacchetti sono stati installati automaticamente e non sono più richiesti:
  libsensors-config libsensors5
Usare "sudo apt autoremove" per rimuoverli.
I seguenti pacchetti saranno RIMOSSI:
  sysstat* xz-utils*
0 aggiornati, 0 installati, 2 da rimuovere e 877 non aggiornati.

Su Debian stable; ma anche sulla mia macchina “da combattimento”, è bastato un sudo apt update; sudo apt -t testing install xz-utils