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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:25:05+00:00 2026-05-27T21:25:05+00:00

I have a file generated by a compiler that has warning messages in the

  • 0

I have a file generated by a compiler that has warning messages in the following format:

--a couple of lines of text--

    Warning-[code1] <some description>
    <some path>, error code
    --3-4 lines of cryptic messages--

    Warning-[code2] <some description>
    <some path>, error code
    --3-4 lines of cryptic messages--

    Warning-[code1] <some description>
    <some path>, error code
    --3-4 lines of cryptic messages--

    etc...

I have a script that will read in the codes, but the problem is some codes are repeated like 10 times and i want to read them once i.e uniquify them. I was thinking of reading the entire file in an array and then uniquify it based on the codes? But is it possible? before i go ahead and start coding.

Really appreciate your input/help/thoughts 🙂

  • 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-27T21:25:06+00:00Added an answer on May 27, 2026 at 9:25 pm

    The Hash structure provides a simple method for capturing this kind of information. If you can extract the key, then just capture the block of data you need, then either replace it, or use the first instance.

    Example:

    capturing = nil
    captured = { }
    
    while (line = gets)
      if (line.match(/...starting...(code).../))
        capturing = ''
        key = $1
      elsif (capturing and line.match(/...finishing.../)
        captured[key] ||= capturing
        capturing = nil
      elsif (capturing)
        capturing << line
      end
    end
    

    This is a common pattern for extracting delimited information from a log file. You will need to adjust the starting and fininishing regular expressions, of course.

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

Sidebar

Related Questions

I have a generated txt file. This file has certain lines that are superfluous,
We have a tool that generates source files, and each generated file has several
I have a text file on my local machine that is generated by a
I have a core file generated on a remote system that I don't have
I have a database file that is generated on a PC using Sqlite. This
I have an automatically generated XML file for the game that I run. It
Suppose that one has some lock based code like the following where mutexes are
I have a file named A/B/SomeFile.dll that gets generated by visual studio on each
Let say I have a file that has a lot of preprocessor macros that
I have a sql file generated by mysqldump --all-databases . There are many databases

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.