Execute awk output with continuous streaming input
I need to parse some continuous output from a program (i.e. aScript.py) into a portal that uses curl. I've written a simple awk one-liner to parse the information that is output from aScript.py, but I'm not able to execute it. I can succeed with just one line of the output from aScript.py: echo curl "awk output" | xargs curl , but this doesn't work for continuous output from the aScript.py program. Here is what I want to be able to do:
In this example aScript.py is extracting data that is continuously collected. My awk line is parsing the output into a line necessary for porting the data into a program. How can I get the output of my awk line to execute continuously as the data comes in? Perhaps a loop is necessary?
Solved with:
Moderator's Comments:
Please use CODE tags (not ICODE tags) for full-line and multi-line code segments, sample input, and sample output. And, not that opening tags need matching close tags.
Last edited by Don Cragun; 03-10-2016 at 02:48 AM..
Reason: Fix tags.
Have your awk output commands for the shell and pipe that into sh.
This one doesn't work because, it seems, that sh will only execute once the output from my aScript.py is finished. aScript.py runs continuously. I found the solution with the following:
Hello,
I've written an awk one-liner to parse a stream of real-time data. I invoke a program that gives me output from which I extract a few columns, perform some simple calculations, and then stream that data into a portal using an http string. It's tricky because I have to run it every second... (2 Replies)
Hi,
I want to compare a value from test file and redirect the o/p value to the same file
input file
250 32000 32 128
Below is my code
awk '{ if ($1 < "300") print $1 > /tmp/test}' test
want to compare 250 < 300 then print 300 to the same place
below is the... (24 Replies)
Hi,
I have a function in a bash script that returns a string after some operations using awk.
The following code returns 555
$VARIABLE="EXAMPLE"
get_number $VARIABLE
this value I'd like to pass it as a second argument of another script with the following usage
myscript.sh <param1>... (7 Replies)
Hi,
i am new to awk. I am using csv2pipe script(shown below)
BEGIN { FS=SUBSEP; OFS="|" }
{
result = setcsv($0, ",")
print
}
# setcsv(str, sep) - parse CSV (MS specification) input
# str, the string to be parsed. (Most likely $0.)
# sep, the separator between the values.
#
#... (6 Replies)