About 78,800 results
Open links in new tab
  1. How to grep Lines Containing N Digits or Numbers | Baeldung on Linux

    Mar 18, 2024 · We can extract lines with a specific number of digits (N) from a file using either grep or perl. Both of these commands provide several options to search for patterns in files and directories, enabling us to customize the search criteria and perform advanced pattern matching.

  2. Mastering grep with Regular Expressions: Guide for Efficient Text ...

    Apr 21, 2025 · Regular expressions can be used to detect near-duplicate entries or misspellings by matching similar patterns. For example, to find lines that contain words with a single character difference, you can use the following command:

  3. Using find to locate files that match one of multiple patterns

    Simpler: find . -regex ".*\.\(py\|html\)$" this works because find defaults to Emacs-style regular expressions, which are slightly different, so you don't have to specify the regextype. If you have many expressions -regextype posix-egrep is handy (otherwise you'd need to …

  4. command line - How do I fetch only numbers in grep? - Ask Ubuntu

    Sep 5, 2012 · grep -o will print only the matching part of the line. Otherwise grep will print any lines with the pattern. I would use curl to access your file locally or remotely, then I would grep lines with numbers wrapped in (: ) then cut those pieces off and write to file.

  5. 25 most used grep pattern scenarios in Linux - GoLinuxCloud

    May 19, 2024 · In this tutorial, we will discuss 25 grep command scenarios with examples in Linux. Sample text file which we will use through out this tutorial. 1. grep pattern and print next N lines. By default, grep prints lines that match the pattern. But sometimes, you may need to print N lines after matching the pattern.

  6. search - Count number of occurrences of a pattern in a file (even …

    May 26, 2010 · Two matches are found in the line (a{foo}bar{foo}bar) because we explicitly asked to find every occurrence (-o). Every occurence is printed on a separate line, and wc -l just counts the number of lines in the output.

  7. Count total number of occurrences using grep - Unix & Linux

    Here's a simpler solution using sed and grep, which works for strings or even by-the-book regular expressions but fails in a few corner cases with anchored patterns (e.g. it finds two occurrences of ^needle or \bneedle in needleneedle).

  8. Linux grep Command: Advanced Text Search and Pattern Matching

    Jan 10, 2024 · The grep command is a powerful text search tool in Linux that uses regular expressions to find patterns in files. This guide covers both basic and advanced usage with real-world examples. grep [options] pattern [file...] 1. Basic Text Search. 2. Case Insensitive Search. 3. Recursive Search in Directory. 4. Count Matches. 1. Regular Expressions. 2.

  9. How to Use Grep and Regular Expressions in Linux

    Feb 11, 2025 · Learn how to grep with regex to search for text patterns in linux. Practical guides and step-by-step instructions for IT professionals and beginners from Hostman.

  10. Bash grep Command - Search Text Using Patterns - W3Schools

    The grep command is used to search for text patterns within files. It's a powerful way to find specific text in large files or across many files. Basic Usage. To search for a pattern in a file, use grep 'pattern' filename: Example. grep 'shell' file.txt A shell is a text-based interface that lets you talk to your computer. There are different ...

    Missing:

    • Numbers

    Must include:

  11. Some results have been removed
Refresh