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

  • Home
  • SEARCH
  • 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 6382635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:32:54+00:00 2026-05-25T02:32:54+00:00

This is a sed and RegEx beginner question, but I was not able to

  • 0

This is a sed and RegEx beginner question, but I was not able to answer it myself through googling.


Szenario

I have got a plain text file like this as the log file of a command:

Checking version of 'make' >= 379... succeeded. (382)
Checking version of 'm4' >= 104... succeeded. (104)
Checking version of 'pkg-config' >= 15... succeeded. (25)
Checking version of 'autoreconf' >= 258... succeeded. (268)
Checking version of 'automake' >= 108... ./_autosetup: line 28: type: automake: not found

Desired Outcome

I would like to extract all words within the single quotes, which occur in combination with not found at the end of line.


What I Did and the Problem

Thus, I first grep for not found and pipe the result to sed: (I am using the line of the not found later, thus -n with grep)

grep -n "not found" < textfile.log | sed -n 's/.*\(\'.*\'\).*/\1/p'

With this I am getting two errors: First, that it reached end of file while searching ' and second, that the end of file was unexpected.

I also tried

grep -n "not found" < textfile.log | sed -n 's/.*[\']\(.*\)[\'].*/\1/p'

to only get the word within the single quotes without the quotes. Only getting the same errors.


Thanks for your help.

  • 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-05-25T02:32:54+00:00Added an answer on May 25, 2026 at 2:32 am

    Use that line instead:

    grep -n "not found" < textfile.log | sed -n "s/.*\('.*'\).*/\1/p"
    

    You can use double quotes to quote ' inside the pattern (so you don’t have to backquote them.) That expression also includes the quotes. Without the quotes themselves would require using the parentheses inside the quotes:

    grep -n "not found" < textfile.log | sed -n "s/.*'\(.*\)'.*/\1/p"
    

    But I guess you already know that.

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

Sidebar

Related Questions

This might seem like a stupid question I admit. But I'm in a small
This is a difficult and open-ended question I know, but I thought I'd throw
I tried searching for an answer but lost in questions. Basically I have a
To use regex syntax in sed, you have to put in \ before (
I have a problem finding a sed script that works when the regex looks
Is there a way to have this regex put ${color orange} at the beginning,
I am very lost with this Regex. I have a HTML Table with 3
Note: This is a Java -only question (i.e. no Javascript, sed, Perl, etc.) I
I have this working regex (tested on regex coach): \n[\s]*[0-9]*[\s]*[0-9]*(\.)?[0-9]*(e\+)?[0-9]* that is supposed to
sed -e 's/ *-\{0,1\},\{0,1\} *[Pp][Aa]\{0,1\}[Rr]\{0,1\}[Tt].\{0,1\} *\([0-9]\{1,\}\) *$/ (\1)/' I'm piping titles through this from

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.