Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8556433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:20:59+00:00 2026-06-11T15:20:59+00:00

I am looking for some help with grep, or grep like tools. This includes

  • 0

I am looking for some help with grep, or grep like tools. This includes but not limited to grep, egrep, awk, sed, or what ever other tool that is used for searching for matches. But i will just call it grep for the rest of the question.

I am looking for the fast way to grep a file for a match, and i am also looking for the fastest way to grep a file for a match and to only return the line number its on not the rest of the matched line. I dont mind if the syntax is complex as long as its fast, I am going to be using it in a program complexity is not the issue.

I also need this method to work if I need to regex for a pattern so i can also search for a range. So if i need to search for all numbers less than 10 if the commmand supports it by default of or if it needs to be some regex i am just looking for the fastest method that i can find.

thank you.

Edit

The files i am working with will be very large, my test file is 1.9gb

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:21:00+00:00Added an answer on June 11, 2026 at 3:21 pm

    i think KingsIndian is on target with the -m option to grep, but if speed is your main goal, cut may be faster than awk for this particular usage. try:

    grep -n -m 1 regex file | cut -d: -f1
    

    the -d: argument tells cut to use a colon as a field seperator, while the -f1 argument tells it to only output the first field.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for some regex/automata help. I'm limited to + or the Kleene Star.
I'm looking for some help to get rid of this error. As i'm running
I'm looking for some help with the following. This will be a very general
I'm looking for some help to implent a timer for this script I'm linking
I'm looking for some help converting this from prototype to jQuery. I'm doing some
Im looking for some help regarding to put a save like confirmation if some
I have posted this a few times looking for some help, I cant seem
I am new to all this so looking for some help. Sorry if the
i've run out of idea's on this one so looking for some help to
Looking for some help with this perl regex. I need to extract (3) items

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.