[Semibug] Need an example of libxo usage

Mike Wayne semibug15 at post.wayne47.com
Mon Apr 15 10:34:34 EDT 2024


On Sat, Apr 13, 2024 at 08:48:41AM -0700, admin at bclug.ca wrote:
> Mike Wayne wrote on 2024-04-12 15:55:
>
> I think JSON should do it via `jq`.

Any idea what package jq might be in? Never heard of it.

> printf "%s last login %s from %s\n" $(lastlogin --libxo json | jq -r '.user,.login-time,.from')

> A couple things to watch for: JSON / jq won't like a key with a hyphen, 
> such as login-time.  I'd assume / hope that libxo would do the 
> transformation required for proper JSON.
> 
> 
> Also, IFS might need tweaking as the date containing spaces will get 
> parsed into separate printf string placeholders.
> 
> Or some `sed` transforms.

Sounds like the --libxo option isn't all that functional as it appears to
need additional commands to parse the output rather than just displaying
arguments using command line options.



More information about the Semibug mailing list