8 lpjobs - Show printer queue jobs (wrapper for lpq and lpstat)
19 sed -e '/^no entries$/ d' |\
21 ifne td-select
-H Job Rank
'File(s)' |\
24 declare -a job_filename
25 declare -a job_printer
26 declare -a job_datetime
29 while read -r jobid rank filename
31 job_rank
[$jobid]=$rank
32 job_filename
[$jobid]=$filename
36 LANG
=C lpstat
-o | td-trans
-m 4 |\
37 td-add-headers
-X PRINTERJOBID USER SIZE DATETIME |\
38 td-alter _
='($printer, $jobid) = PRINTERJOBID =~ /^(.+?)-(\d+)$/' PRINTER
='$printer' JOBID
='$jobid' |\
39 ifne td-select
-H JOBID PRINTER DATETIME |\
41 while read -r jobid printer datetime
43 job_printer
[$jobid]=$printer
44 job_datetime
[$jobid]=$datetime
48 echo "JOB${TAB}PRINTER${TAB}RANK${TAB}DATETIME${TAB}FILE"
50 for jobid
in `printf '%s\n' "${!jobs[@]}" | sort -n`
52 echo "$jobid${TAB}${job_printer[$jobid]}${TAB}${job_rank[$jobid]}${TAB}${job_datetime[$jobid]}${TAB}${job_filename[$jobid]}"