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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:13:53+00:00 2026-06-13T14:13:53+00:00

I’m trying write simple notify app in bash. I want to read output from

  • 0

I’m trying write simple notify app in bash. I want to read output from mplayer, parse it and display through notify-send.

I can get desired info from mplayer using this:

mplayer <url> | grep ICY

and then parse in using sed.

I create named pipe, tell mplayer to write it and then I’m reading from it. Unfortunately, it doesn’t work. Here’s my script:

$fifo=~/.rp/fifo
mkfifo $fifo

mplayer <url> 2>/dev/null | grep ICY 1> $fifo &

while read line < $fifo; do
    echo $line
done

wait

Program keeps waiting to input from $fifo. I tried following in other terminal, while this script is running:

  1. Run

    echo "Test" > .rp/fifo
    

    Terminal with running script shows “Test”

  2. Run

    echo "ICY" | grep ICY > .rp/fifo
    

    also works.

  3. Run

    mplayer <url> | grep ICY > .rp/fifo
    

    and it doesn’t work.

Is I said above, the combination of mplayer | grep works fine. grep > $fifo works fine. I don’t understand why mplayer | grep > $fifo doesn’t work.

  • 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-13T14:13:54+00:00Added an answer on June 13, 2026 at 2:13 pm

    You could do unbuffered grep with:

    $ mplayer ...  2>&1 | grep --line-buffered "ICY"
    

    or better:

    $ mplayer ...  2>&1 | sed -une 's/^.*ICY[^:]*: //p'
    

    or even, why not (sed is very nice for grep and formatting),
    this will grep ICY lines and even split line containing - in a first field of 30 chars length separed by a : from a second field:

    $ mplayer ...  2>&1 |
        sed -une "
            /ICY/{
                s/^.*ICY[^:]*:.*'\([^']*\)';/\1/;
                s/^\(.*\) - /\1                              - /;
                s/^\(.\{30\}\) *- /\1: /;
                p;
        }"
    

    could give something like:

    Artist name                  : Song title
    Other artist                 : Other song
    Unsplited line
    Artist                       : Title
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to parse a xhtml file and display in UITableView. what is the
I am trying to understand how to use SyndicationItem to display feed which is
I have a French site that I want to parse, but am running into
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to loop through a bunch of documents I have to put
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

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.