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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:34:59+00:00 2026-06-08T23:34:59+00:00

I have a Linux driver running in the background that is able to return

  • 0

I have a Linux driver running in the background that is able to return the current system data/stats. I view the data by running a console utility (let’s call it dump-data) in a console. All data is dumped every time I run dump-data. The output of the utility is like below

Output:
- A=reading1
- B=reading2
- C=reading3
- D=reading4
- E=reading5
...
- variableX=readingX
...

The list of readings returned by the utility can be really long. Depending on the scenario, certain readings would be useful while everything else would be useless.

I need a way to grep only the useful readings whose names might have have nothing in common (via a bash script). I.e. Sometimes I’ll need to collect A,D,E; and other times I’ll need C,D,E.

I’m attempting to graph the readings over time to look for trends, so I can’t run something like this:

# forgive my pseudocode
Loop
    dump-data | grep A
    dump-data | grep D
    dump-data | grep E
End Loop

to collect A,D,E as that would actually give me readings from 3 separate calls of dump-data as that would not be accurate.

  • 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-08T23:35:01+00:00Added an answer on June 8, 2026 at 11:35 pm

    If you want to save all result of grep in the same file, you can just join all expressions in one:

    grep -E 'expr1|expr2|expr3'
    

    But if you want to have results (for expr1, expr2 and expr3) in separate files, things are getting more interesting.

    You can do this using tee >(command).

    For example, here I process the same pipe with thre different commands:

    $ echo abc | tee >(sed s/a/_a_/ > file1) | tee >(sed s/b/_b_/ > file2) | sed s/c/_c_/ > file3
    $ grep "" file[123]
    file1:_a_bc
    file2:a_b_c
    file3:ab_c_
    

    But the command seems to be too complex.

    I would better save dump-data results to a file and then grep it.

    TEMP=$(mktemp /tmp/dump-data-XXXXXXXX)
    dump-data > ${TEMP}
    grep A ${TEMP}
    grep B ${TEMP}
    grep C ${TEMP}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Linux device driver that interfaces to a device that, in theory,
I am reading linux device driver book of rubini,corbet and hartmen.I have doubt regarding
I have a FAT filesystem mounted in Linux with the vfat driver. I want
I have a linux C program that handles request sent to a TCP socket
Recently, i began developing a driver of an embedded device running linux. Until now
I have an application running on Linux, catching signals and reporting them to syslog.
My problem is this: I have a C/C++ app that runs under Linux, and
On my AT91SAM9RL-EK ARM board, running a Linux 2.6.30 buildroot, I have the following.
I have a blocking read in linux running in a thread. During program shutdown
I am running linux from bluehost and have PDO installed. I wish to access

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.