Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

grep

Grep huge number of patterns from huge file

August 9, 2022 by Magenaut

I have a file that’s growing about 200,000 lines a day, and it is all formed with blocks of three lines as such:

Categories Q&A, Unix & Linux Tags awk, database, grep, text Leave a comment

What is the email matching regex in basic regex for grep?

August 9, 2022 by Magenaut

I created a text file and put some email addresses in it. Then I used grep to find them. Indeed it worked:

Categories Q&A, Unix & Linux Tags command-line, grep, regular-expression, shell Leave a comment

Count total number of occurrences using grep

August 9, 2022 by Magenaut

grep -c is useful for finding how many times a string occurs in a file, but it only counts each occurence once per line. How to count multiple occurences per line?

Categories Q&A, Unix & Linux Tags grep Leave a comment

How to search text throughout entire file system?

August 9, 2022 by Magenaut

Assuming that the grep tool should be used, I’d like to search for the text string “800×600” throughout the entire file system.

Categories Q&A, Unix & Linux Tags grep, recursive Leave a comment

How to check if any IP address is present in a file using shell scripting?

August 9, 2022 by Magenaut

I have a script that generates some output. I want to check that output for any IP address like

Categories Q&A, Unix & Linux Tags grep, ip, shell-script Leave a comment

How to display lines 2-4 after each grep result?

August 9, 2022 by Magenaut

I’m parsing a mailbox file that stores e-mail server reports for unsuccessfully delivered e-mail. I wish to extract bad e-mail addresses, so that I remove them from the system. The log file looks like this:

Categories Q&A, Unix & Linux Tags grep Leave a comment

List the files containing a particular word in their text

August 9, 2022 by Magenaut

I would like to list the files recursively and uniquely that contain the given word.

Categories Q&A, Unix & Linux Tags file-search, find, grep Leave a comment

How to grep lines between start and end pattern?

August 9, 2022 by Magenaut

I have a file which is having following content: zdk aaa b12 cdn dke kdn Input1: aaa and cdn Output 1: aaa b12 cdn Input 2: zdk and dke Output 2: zdk aaa b12 cdn dke I could use below commands to achieve: grep -a aaa -A2 file # Output 1 grep -a aaa -A4 … Read more

Categories Q&A, Unix & Linux Tags awk, grep, sed, text-processing Leave a comment

Why does grep not work with redirection?

August 9, 2022 by Magenaut

Using the top command with redirection works fine:

Categories Q&A, Unix & Linux Tags bash, grep Leave a comment

grep doesn’t output until EOF if piped through cat

August 9, 2022 by Magenaut

Given this minimal example

Categories Q&A, Unix & Linux Tags bash, grep, pipe Leave a comment
Older posts
Newer posts
← Previous Page1 … Page4 Page5 Page6 … Page10 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress