Here’s your report of what has happened in Fedora Program Management this week.
I have weekly office hours in #fedora-meeting-1. Drop by if you have any questions or comments about the schedule, Changes, elections, or anything else.
Continue readingHere’s your report of what has happened in Fedora Program Management this week.
I have weekly office hours in #fedora-meeting-1. Drop by if you have any questions or comments about the schedule, Changes, elections, or anything else.
Continue readingThe kernel team is working on final integration for kernel 5.3. This version was just recently
Friday, 2019-09-27 is the Fedora 31 Modularity Test Day!
We need your help to test if everything runs smoothly.
Fedora 31 will be released soon. It’s time to start planing activities around the release.
The most common activity to do is organize release parties. A release party is also a great way for other contributors in the community to get involved with advocacy in their local regions. Learn how to organize a release party and get a badge for it in this article.
Continue readingHere’s your report of what has happened in Fedora Program Management this week.
I have weekly office hours in #fedora-meeting-1. Drop by if you have any questions or comments about the schedule, Changes, elections, or anything else.
Continue readingAs a Linux programmer or system admin, it is common to search through text for a given sequence of characters (such as a word or phrase), called a string, or even for a pattern describing a set of such strings; this article contains few hands-on examples for doing these types of tasks. In this article, we first review how grep Linux works while reviewing few basic string searches. It follows by diving into more complex string search using grep with regular expression.
The primary command used for searching through text is a tool called grep. It outputs lines of its input that contain a given string or pattern.
To search for a word, give that word as the first argument. By default, grep searches standard input; give the name of a file to search as the second argument.
To output lines in the file ‘catalog’ containing the word ‘boy’, type:
$ grep boy catalog
To search for a phrase, specify it in quotes.
To output lines in the file ‘book’ containing the word ‘Java Coding’, type:
$ grep ’Java Coding’ book
The preceding example outputs all lines in the file ‘book’ that contain the exact string ‘Java Coding’; it will not match, however, lines containing ‘java coding’ or any other variation on the case of letters in the search pattern. Use the ‘-i’ option to specify that matches are to be made regardless of case.
To output lines in the file ‘book’ containing the string ‘java coding’ regardless of the case of its letters, type:
$ grep -i ’java coding’ book
This command outputs lines in the file ‘book’ containing any variation of the pattern ‘java coding’, including ‘java coding’, ‘JAVA CODING’, and ‘jaVA coDIng’.
One thing to remember is that grep only matches patterns that appear on a single line, so in the preceding example, if one line in ‘book’ ends with the word ‘java’ and the next begins with ‘coding’, grep will not match either line.
You can specify more than one file to search. When you specify multiple files, each match that grep
outputs is preceded by the name of the file it is in (and you can suppress this with the ‘-h’ option.). A good knowledge of Linux filesystem would be helpful to navigate the right file and folder directories.
To output lines in all of the files in the current directory containing the word ‘JAVA’, type:
$ grep JAVA *
To output lines in all of the ‘.txt’ files in the ‘˜/doc’ directory containing the word ‘Java’, suppressing the listing of file names in the output, type:
$ grep -h Java ˜/doc/*.txt
Use the ‘-r’ option to search a given directory recursively, searching all subdirectories it contains.
To output lines containing the word ‘Java’ in all of the ‘.txt’ files in the ‘˜/doc’ directory and in all of its subdirectories, type:
$ grep -r Java ˜/doc/*.txt
In addition to word and phrase searches, you can use grep to search for complex text patterns called regular expressions. A regular expression—or “regexp”—is a text string of special characters that specifies a set of patterns to match.
Technically speaking, the word or phrase patterns described in the previous section are regular expressions—just very simple ones. In a regular expression, most characters—including letters and numbers—represent themselves. For example, the regexp pattern 1 matches the string ‘1’, and the pattern boy matches the string ‘boy’.
There are a number of reserved characters called metacharacters that do not represent themselves in a regular expression, but they have a special meaning that is used to build complex patterns. These metacharacters are as follows: ., *, [, ], ˆ, $, and \. It is good to note that such metacharacters are common among almost all of common and special Linux distributions. Here is a good article that covers special meanings of the metacharacters and gives examples of their usage.
To specify one of these literal characters in a regular expression, precede the character with a ‘\’.
To output lines in the file ‘book’ that contain a ‘$’ character, type:
$ grep ’\$’ book
To output lines in the file ‘book’ that contains the string ‘$14.99’, type:
$ grep ’\$14\.99’ book
To output lines in the file ‘book’ that contain a ‘\’ character, type:
$ grep ’\\’ book
Summary
In this article, we reviewed how to search string in a text file in the Linux using grep command. We also discussed how to combine the power of regular expressions with grep to run complex string searches.
Monday 2019-09-23, is the Fedora 31 Upgrade Test Day! As part of preparing for the final release of Fedora 31, we need your help to test if everything runs smoothly!
Continue readingNow that Modularity is available for all Fedora variants, it’s time to address issues discovered and improve the experience for packagers and users. The Modularity team identified a number of projects that will improve the usefulness of Modularity and the experience of creating modules for packagers. We are proposing a renewed objective to the Fedora Council.
You can read the updated objective in pull request #61. Please provide feedback there or on the devel mailing list. The Council will vote on this in two weeks.
Recently the Community Platform Engineering (CPE) team announced that we need to focus on key areas and thus let some of our applications go. So we started Friday with Infra to find maintainers for some of those applications. Unfortunately the first few occurrences did not seem to raise as much interest as we had hoped. As a result we are still looking for new maintainers for Fedocal and Nuancier.
Continue readingWednesday, 2019-09-18 is the Fedora 31 Gnome Test Day! As part of changes Gnome 3.34 in Fedora 31, we need your help to test if everything runs smoothly!
Continue readingCopyright © 2024 Fedora Community Blog

This work is licensed under a Creative Commons Attribution 4.0 International License.
Theme by Anders Noren — Up ↑
Recent Comments