[Semibug] Need an example of libxo usage
Mike Wayne
semibug15 at post.wayne47.com
Fri Apr 12 18:55:13 EDT 2024
On Fri, Apr 12, 2024 at 01:21:58PM -0700, Ron / BCLUG wrote:
> Mike Wayne wrote on 2024-04-12 12:57:
>
> > What I can not figure out is how to select fields to print.
>
> To customize the output fields for the lastlogin command using libxo
> with XML formatting in FreeBSD, you'll need to use the -f option to
> specify the fields you want to include. Here's how you can do it:
>
> lastlogin -f field1,field2,... --libxo xml,pretty
Not too helpful.
-f specifies the lastlogin FILE to use, not fields
As mentioned, I'm trying to use --libxo text, not xml
Looking to get lastlogin to print a single line:
wayne last login: Fri Apr 12 15:06:16 2024 from 192.168.63.146
I'm guessing I need the printf equivalent for libxo but it appears
not to be documented anywhere.
So something like:
lastlogin --libxo '("%s last login in at %s from %s ", user, login-time, from)' wayne
> Replace field1, field2, etc., with the specific fields you want to
> include in the output. For example, if you want to include fields like
> username, terminal, and login time, you would specify something like this:
>
> lastlogin -f username,terminal,login_time --libxo xml,pretty
>
>
> This command will generate XML output with the specified fields in a
> pretty format. Adjust the field names as per your requirements.
More information about the Semibug
mailing list