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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:13:14+00:00 2026-05-12T06:13:14+00:00

I have an ASCII log file with some content I would like to extract.

  • 0

I have an ASCII log file with some content I would like to extract. I’ve never taken time to learn Perl properly, but I figure this is a good tool for this task.

The file is structured like this:

... 
... some garbage 
... 
... garbage START
what i want is 
on different
lines 
END 
... 
... more garbage ...
next one START 
more stuff I want, again
spread 
through 
multiple lines 
END 
...
more garbage

So, I’m looking for a way to extract the lines between each START and END delimiter strings.
How can I do this?

So far, I’ve only found some examples on how to print a line with the START string, or other documentation items that are somewhat related with what I’m looking for.

  • 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-12T06:13:15+00:00Added an answer on May 12, 2026 at 6:13 am

    You want the flip-flop operator (also known as the range operator) ..

    #!/usr/bin/env perl
    use strict;
    use warnings;
    
    while (<>) {
      if (/START/../END/) {
        next if /START/ || /END/;
        print;
      }
    }
    

    Replace the call to print with whatever you actually want to do (e.g., push the line into an array, edit it, format it, whatever). I’m next-ing past the lines that actually have START or END, but you may not want that behavior. See this article for a discussion of this operator and other useful Perl special variables.

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

Sidebar

Related Questions

In my app, I have a simple ASCII file which stores some config info
I have a file full of ascii data. How would I append a string
I have an application which updates my datagrid each time a log file that
I would like to read a (fairly big) log file into a MATLAB string
I have an ASCII file that contains tab-delimited data like this: Test_Version=2.5.3 Model-Manufacturer=D12-500 Test_Version=2.5.3
I have a RAR file with non ASCII letters in filenames. I tried decoding
I have Uitable with data read from a AScii file. I want to select
I have some C code that stores ASCII strings in memory as a four
I have an activity that runs some ASCII control over a network port to
I have some ascii files that are 60-100MB in size. I want to store

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.