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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:15:46+00:00 2026-05-27T09:15:46+00:00

I am building a program to poll a network device every 48 hours and

  • 0

I am building a program to poll a network device every 48 hours and record the output user Perl and the Expect module. At the moment, I am saving the output text to a text file and then filtering the text file to get the required information. Originally, this was fine since efficiency wasn’t that big of a problem when dealing with file that are only a hundred KB in size and keeping most of the text anyway, but I’ve found a new command I want to execute remotely on the network device. This command takes an hour and a half to run, creates a text file around 5MB in size and I would probably only be keeping 10KB of information. Using basic file I/O (read a text file, write to a text file) just seems like a bad idea and I keep thinking that there has to be a better way.

What my research has turned up so far:
I should probably be using some sort of Pipe. Something like:

open($filehandle, "myCommand");


There are other solutions out there, but they seem to imply that I save the ENTIRE file to one variable, when I would like to only save and modify parts of it before writing to a file.
TIEHANDLE works well for overwiting "print", but I don't think that's necessary or will work here.

What I've tried so far:
Redirecting STDOUT using a pipe. Result: Kept on sending the output to a file and couldn't edit the text before it was put in the file.

I have run out of things to Google. If a complete solution is too daunting of a task, a hint as to where the next steps might be would also be greatly appreciated.

Also, if the advantages in terms of processing time are actually minimal (I'm unclear on how long it takes to process a 5mb test file and will investigate), please let me know.

  • 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-27T09:15:46+00:00Added an answer on May 27, 2026 at 9:15 am

    Perl can crunch through a 5MB file in no time, I would not worry about trying to redirect the output to a pipe when you can just open the file and parse through it once your job is done running.

        open(INPUT, "/path/to/file.log") or die "Can't open file: $!";
    
        while (<INPUT>) {
        chomp;
          if (/ERROR/) {
            print "Found an error!";
          }
        }
        close(INPUT);
        exit;
    

    When you’re in the while() loop, you can use regex, split, or whatever you want to find what you’re looking for in the file. The current line is stored in $_. You will get one iteration for each line of your input file.

    Hope this helps…

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

Sidebar

Related Questions

I am building programming contest software. A user's program is received by our judging
I'm building a program that does network acceleration, and I need to know how
I am building an user interface. My program will consist of 4 main parts:
I am building a program in c++ where the user can set a function
I'm currently building a program which adds to the current user's shell depending on
i'm building a program that does certain operations according to the user's speed. is
I have downloaded a code when I am building the program, a message window
I'm building my c++ program with cmake on a Mac. The compiler gives me
I am building a C# program that unzips a file, and work on this
I am building a time registration program. Users can work on a project, and

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.