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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:16:26+00:00 2026-06-09T20:16:26+00:00

need your help!!! I tried looking for this but to no avail. How can

  • 0

need your help!!! I tried looking for this but to no avail.

How can I achieve the following using bash?

I’ve a flat file called “cube.mdl” that contains:

[...]
bla bla bla bla lots of lines above
Cube 8007841 "BILA_" MdcFile "BILA_CO_PM_MKT_BR_CUBE.mdc"
bla bla bla more lines below
[...]

I need to open that file, look for the word “MdcFile” and get the string that follows between quotes, which would be BILA_CO_PM_MKT_BR_CUBE.mdc

I know AWK or grep are powerful enough to do this in one line, but I couldn’t find an example that could help me do it on my own.

Thanks in advance!
JMA

  • 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-09T20:16:28+00:00Added an answer on June 9, 2026 at 8:16 pm

    You can use:

    grep -o -P "MdcFile.*" cube.mdl | awk -F\" '{ print $2 }'
    

    This will use grep‘s regex to only return MdcFile and everything after it in the current line. Then, awk will use the " as a delimiter and print only the second word – which would be your “in-quotes” word(s), returned without the quotes of course.

    The option -o, --only-matching specifies to return only the text matching that matches and the -P, --perl-regexp specifies that the pattern is a Perl-Regex pattern. It appears that some versions of grep do not contain these options. The OP’s version is a version that does not include them, but the following appears to work for him instead:

    grep "MdcFile.*" cube.mdl | awk -F\" '{ print $2 }'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need your help. I tried to play an audio file stored in Assets
need your help. I tried myself but cant solve it. I have a table
i have never tried something like this so i need your help. i have
Ok, I tried holding off and looking for answers, but I need your guys'
I need your help to translate a query into pyes. This query is working
I tried looking this up in google, but couldnt find any anything... I am
i really need your help with a CSS-Layout. I tried a few time, however
I need your help. I'm parsing wikipedia article and using Wikimedia api. I want
I need your help, i'm stacked on this project. When i run my applicaion
I need your help in creating dynamic URL for SEO gains.. I tried to

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.