A civil engineer with a longlife fondness for Software Libero
Category: Documentations
The different extended pattern matching operators are listed below, where pattern-list is a list containing one or more filenames, separated using the | character:
*(pattern-list) – matches zero or more occurrences of the specified patterns
?(pattern-list) – matches zero or one occurrence of the specified patterns
+(pattern-list) – matches one or more occurrences of the specified patterns
@(pattern-list) – matches one of the specified patterns
!(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:
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:
Using Parameter expansion: ${String/pattern/replacement}
Using the sed command: sed 's/pattern/replacement/' filename
Using the awk command: "input_str" | awk 'pattern { action }'
Using the perl command: perl [options] -e 'action' filename
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.
stress and stress-ng are essential tools for assessing and testing the performance of Linux systems under various conditions. Source: How to Stress Test Your Linux CPU for High Load
Technical debt can cause so much frustration and burnout to development teams. Software engineers can be aware of the side effects of… Source: How To Deal With Technical Debt. Technical debt can cause so much… | by Dr Milan Milanović | Dec, 2023 | Medium
PSSH is a small Python-based program, which allows you to execute commands on multiple Linux remote servers in parallel at the same time using the single shell.
Ever wonder about that mysterious Content-Type tag? You know, the one you’re supposed to put in HTML and you never quite know what it should be? Did you ever get an email from your friends in…