On Mon, May 06, 2019 at 10:21:34PM +0200, Alexander Burger wrote:
> (pipe
> (in '("curl" "-s" "https://api.iextrading.com/1.0/stock/aapl/chart/3m")
> (while
> (prin
> (echo "volume" "unadjustedVolume") )
> (echo ",")
> (prin ".0,") ) )
> ...
> The code echoes all text until it hits one of the target strings. In such case
> it echoes the number till the comma, then prints ".0" and a comma.
This way has the additional advantage that it is extremely fast.
It just scans and echoes the input stream in a single linear pass. Much better
than regular expression matching with all its overhead.
And it is a lot simpler :)
☺/ A!ex
--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe