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 7794827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:53:21+00:00 2026-06-01T22:53:21+00:00

I have the following grep query $ grep -nr ActiveChild\s*= . This finds all

  • 0

I have the following grep query

 $ grep -nr "ActiveChild\s*=" .

This finds all instances of ActiveChild followed by whitespace-

 ActiveChild = "ABC"
    ActiveChild = "PQR"
 ActiveChild = "XYZ"

However, it also gives me results like

 If ActiveChild = "LMN" Then

I want to avoid the above case. I want to ensure that “ActiveChild” is the first word that appears on the line that I am searching. It doesn’t matter if there is whitespace before it. Unfortunately, writing something like

 grep -nr "\s*ActiveChild\s*=" .

doesn’t help at all. How can I write such a query? Also, is “query” the right word, or is something else used in the context of grep?

  • 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-01T22:53:22+00:00Added an answer on June 1, 2026 at 10:53 pm
    kent$  cat test
     ActiveChild = "ABC"
        ActiveChild = "PQR"
     ActiveChild = "XYZ"
     If ActiveChild = "LMN" Then
    
    kent$  grep -E '^\s*ActiveChild\s*=' test
     ActiveChild = "ABC"
        ActiveChild = "PQR"
     ActiveChild = "XYZ"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following script that executes all the .reg files in the current directory.
I have the following command find /var -type f -exec grep param1 {} \;
I have the following custom function in ~/.emacs: (defun xi-rgrep (term) (grep-compute-defaults) (interactive sSearch
I have a following file A Query 3 ms B Query 4 ms A
I have following code for opening all files: int ret= open(zFile, flags, mode); posix_fadvise
I have the following XML output when I grep for Server: <Server id=1 src=/other/Server/PRX01/PRX01.xml/>
I have the following alias in my .aliases: alias gi grep -i and I
I have the following code where I have collected all the file sizes greater
I have the following 2 commands working as expected. grep -B3 'Max_value: 127' proc_*.*
I have the following data that looks like this for example: 34 foo 34

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.