Solved Creating a list of packages sorted by timestamp

I'm trying to create a list of installed packages, sorted by timestamp... And I came up with a script, but it's not working right:
Bash:
for port in `cat ../lists/kde_ports.txt`;
do
    pkg query %t $port | awk '{ print $1"    " $2}' | sort > ../lists/sorted_kde_ports.txt ;
done

%t is the timestamp, and it needs to correspond to $1. $port needs to correspond to $2. That way, the output can be sorted properly.

FWIW, this is a 6-year-old issue, discussed on FreeBSD's email lists... and not solved.

I'm open to using sed or whatever instead of awk, if that helps. If somebody can correct my script, I'd appreciate this!
 
Code:
#!/bin/sh

(
    for port in `cat ../lists/kde_ports.txt`;
    do
        echo `pkg query %t "${port}"` "${port}"
    done
) | sort > ../lists/sorted_kde_ports.txt
?
 
Code:
#!/bin/sh
(
    for port in `cat ../lists/kde_ports.txt`;
    do
        echo `pkg query %t "${port}"` "${port}"
    done
) | sort > ../lists/sorted_kde_ports.txt
?
Wow, that was fast! Gonna check it out on my machine to see if it helps! Thanks! :)
 
WOW... that was exactly what I needed! I could have spent hours googling and reading manuals instead, and still not have it right... Thanks, julp !
 
I found pkg query %t-%n | sort ... checking the man page and
a bit of conjecture... maybe useful here, or to others...
 
Back
Top