> On 12 Mar 2019, at 10:37, Trond Endrestøl 
> <trond.endres...@fagskolen.gjovik.no> wrote:
> I concocted a shell script, it looks promising:
> 
> #!/bin/sh
> #-
> # Parallel mounting of ZFS filesystems leaves a chaotic listing of
> # mounted filesystems when viewed by df(1).
> # Separating the header from the remaining lines and sorting the
> # latter before recombining is a viable solution.
> #-
> 
> DF=/bin/df
> 
> ${DF} ${@} | grep    ^Filesystem
> ${DF} ${@} | grep -v ^Filesystem | sort -k 6
> 
> # new-df.sh

An alternative sort approach, which handles df arguments which change the 
number of columns, and only invokes df once:

${DF} "$@" | awk '/^Filesystem/ { print; sort = "sort -k " NF } ! /^Filesystem/ 
{ print | sort }’

Regards,

Jan.
_______________________________________________
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to