Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-26-2015, 06:54 AM   #1
Registered: Apr 2009
Location: cybernetic space
Distribution: debian
Posts: 42

Rep: Reputation: 1
Edit and direct continuously output from program (rsstail)

I'm using rsstail and I want to edit the output.

rss gives continuously output on the form

$  rsstail -l -n 4 -u
Title: Why does Windows not recognize my USB device if I plug it into a different port?
Title: LLVM merges SafeStack
Title: Life paint
Title: Uber's Original Blog and First Posts
My goal is to get a text file consisting of only the links
... etc, for later use.

That is, for every output something like
echo -e "Title: The man with 1,000 Klein Bottles UNDER his house - Numberphile\nLink:" | awk NR\>1 | cut -c7-
But since the output of rsstail is continuous and I think the ">>"-operator is char-by-char I'm not sure how to accomplish this.

I guess an alternative would be to just
rsstail -l -n 4 -u >> output.txt
and then edit the output.txt file with a cronjob or something but it would be nicer to do it on the fly.

Any suggestions or pointers on how to do this?
Any help would be highly appreciated!
Old 06-27-2015, 05:16 PM   #2
Senior Member
Registered: Aug 2009
Distribution: CentOS
Posts: 3,515

Rep: Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545
Just piping the output through sed should do the job.
rsstail -l -n 4 -u | sed -n 's/^Link: //p'
Translation: Do not print anything by default (-n). On all lines that begin with "Link: ", delete those characters and print what remains.

But, there is still a question of how rapidly you want to see the output. When rsstail sees that its stdout is not a terminal, it will likely switch from line-buffered to block-buffered output and wait until it has a full 4K block to write. sed will do the same thing. Some programs have an option to force line-buffering or non-buffering (e.g., the "--line-buffered" option in grep, or the "-u" (--unbuffered) option in sed). If you need the output to appear immediately, you might check whether rsstail has an option like that. Lacking that, there are programs like unbuffer that will present a pseudo-tty device that you can use as the target of the pipe.

If your output is going to a file, you probably don't need to worry about any of that, but if you are testing with output going to a terminal, you need to be aware of the buffering involved.

(unbuffer is typically distributed as part of the expect package.)

Last edited by rknichols; 06-27-2015 at 05:19 PM.
Old 06-27-2015, 06:56 PM   #3
LQ Addict
Registered: Dec 2013
Posts: 6,224
Blog Entries: 2

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
i've used rsstail for a while and i think it's not very efficient; especially if you have some needs beyond just spitting out plain text.
you might want to hack yourself a script with xmllint or try some html-xml-utils.
once you get the hang of it, it's much easier than fighting with a limited utility.
Old 06-29-2015, 05:56 AM   #4
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,396

Rep: Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395
You could use this maybe


bash, rss

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Script for continuously checking if program running, need help tine Programming 4 11-04-2009 01:53 AM
C program to perform an operation continuously until user presses a key ananth86coolguy Linux - Newbie 4 03-13-2009 09:59 AM
Script or program for continuously retrying to get an IP via DHCP Ken-ji Slackware 4 06-18-2008 12:30 AM
How to direct screen output to a variable? vimal Programming 6 08-29-2006 12:06 AM
How to direct output from make to a file? DDD25 Programming 6 07-25-2004 05:55 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:45 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration