tips

when I brought version 12 up this appeared
$FreeBSD: release12.0/usr.bin/fortune/datafiles/freebsd-tips 325105 2017-10-29 20:20:51Z eadler
does anyone know what this is?
 
Not tested it but...

for i in `seq 5000`; do fortune; done | sort -u > tips.txt

That is likely to get most of them.

(note this is probably the worst way to do it)
 
Not tested it but...

for i in `seq 5000`; do fortune; done | sort -u > tips.txt

That is likely to get most of them.

(note this is probably the worst way to do it)
thanks, no "worst" way btw, just some better ways perhaps?
If I put that in a script, the sort command needs a different option I think

for i in `seq 5000`; do fortune freebsd-tips; done > tips.txt works ok but could be formatted better.

What were you hoping sort -u would provide?
-u, --unique output only the first of lines with equal keys; with -c, check for strict ordering
(one of the more obtuse manpage descriptions I have seen in a while)
 
What were you hoping sort -u would provide?
So this should run the fortune command 5000 times, and for each output, only store it in tips.txt if it is unique. Otherwise you would end up with loads of duplicates.

sort -u should do the same as sort | uniq. In either case, you need to sort using the filter before unique entries can be filtered out.
 
Back
Top