How about this?

./insserv -s | sort | (echo "#<sort> <off> <on> <script>"; \
    while IFS=: read type num levels rest; do
        lvs=
        for lv in $levels; do
                lvs=$lvs${lvs:+,}$lv
        done
        case $type in
        K)      loff=$lvs; lon=- ;;
        S)      loff=-; lon=$lvs ;;
        esac
        echo "$num $loff $lon $rest"
done) | column -t

Could do the printf dance for tabular output, but column -t is nice
as well. This should be POSIX sh, IINM.

bye,
//mirabilos • [email protected] @ freenode #grml observer
-- 
Yay for having to rewrite other people's Bash scripts because bash
suddenly stopped supporting the bash extensions they make use of
        -- Tonnerre Lombard in #nosec



--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to