Trie par date et par url d'un fichier

Fermé
pcsystemd Messages postés 691 Date d'inscription dimanche 27 novembre 2005 Statut Membre Dernière intervention 15 janvier 2024 - 16 oct. 2008 à 15:13
pcsystemd Messages postés 691 Date d'inscription dimanche 27 novembre 2005 Statut Membre Dernière intervention 15 janvier 2024 - 17 oct. 2008 à 05:58
Bonjour,

voila j'ai un fichier qui contient :

16-10-2008|http://www.toto.com/contact/
16-10-2008|http://www.toto.com/blog/
17-10-2008|http://www.toto.com/news/
17-10-2008|http://www.toto.com/page/
17-10-2008|http://www.toto.com/page/
17-10-2008|http://www.toto.com/news/
18-10-2008|http://www.toto.com/forum/
18-10-2008|http://www.toto.com/forum/
18-10-2008|http://www.toto.com/forum/rtfd/
18-10-2008|http://www.toto.com/news/ourcd/
18-10-2008|http://www.toto.com/contact/
18-10-2008|http://www.toto.com/contact/
19-10-2008|http://www.toto.com/rubri/page/dis/
19-10-2008|http://www.toto.com/blog/
19-10-2008|http://www.toto.com/tru/opf/gtp/index/
19-10-2008|http://www.toto.com/page/
19-10-2008|http://www.toto.com/news/
etc..

Et j'ai besoin de le trier les urls identiques par date afin de pouvoir faire des stats comme suit :

le 18-10-2008 il y a eu 2 http://www.toto.com/contact/ vues
le 16-10-2008 il y a eu 1 http://www.toto.com/contact/ vue
etc..

Avez vous une idée?

Merci
A voir également:

2 réponses

jipicy Messages postés 40842 Date d'inscription jeudi 28 août 2003 Statut Modérateur Dernière intervention 10 août 2020 4 894
16 oct. 2008 à 18:13
Salut,

Essaie ça :
[tmpfs]$ cat pcsystemd
16-10-2008|http://www.toto.com/contact/
16-10-2008|http://www.toto.com/blog/
17-10-2008|http://www.toto.com/news/
17-10-2008|http://www.toto.com/page/
17-10-2008|http://www.toto.com/page/
17-10-2008|http://www.toto.com/news/
18-10-2008|http://www.toto.com/forum/
18-10-2008|http://www.toto.com/forum/
18-10-2008|http://www.toto.com/forum/rtfd/
18-10-2008|http://www.toto.com/news/ourcd/
18-10-2008|http://www.toto.com/contact/
18-10-2008|http://www.toto.com/contact/
19-10-2008|http://www.toto.com/rubri/page/dis/
19-10-2008|http://www.toto.com/blog/
19-10-2008|http://www.toto.com/tru/opf/gtp/index/
19-10-2008|http://www.toto.com/page/
19-10-2008|http://www.toto.com/news/

[tmpfs]$ sort pcsystemd | sed 's/|/ /'| uniq -c -f 1 | sort +2 | awk '{ print "le "$2" il y a eu "$1,$3" vue(s)" }'
le 16-10-2008 il y a eu 1 http://www.toto.com/blog/ vue(s)
le 19-10-2008 il y a eu 1 http://www.toto.com/blog/ vue(s)
le 16-10-2008 il y a eu 1 http://www.toto.com/contact/ vue(s)
le 18-10-2008 il y a eu 2 http://www.toto.com/contact/ vue(s)
le 18-10-2008 il y a eu 2 http://www.toto.com/forum/ vue(s)
le 18-10-2008 il y a eu 1 http://www.toto.com/forum/rtfd/ vue(s)
le 19-10-2008 il y a eu 1 http://www.toto.com/news/ vue(s)
le 17-10-2008 il y a eu 2 http://www.toto.com/news/ vue(s)
le 18-10-2008 il y a eu 1 http://www.toto.com/news/ourcd/ vue(s)
le 19-10-2008 il y a eu 1 http://www.toto.com/page/ vue(s)
le 17-10-2008 il y a eu 2 http://www.toto.com/page/ vue(s)
le 19-10-2008 il y a eu 1 http://www.toto.com/rubri/page/dis/ vue(s)
le 19-10-2008 il y a eu 1 http://www.toto.com/tru/opf/gtp/index/ vue(s)

[tmpfs]$ 
;-))
1
pcsystemd Messages postés 691 Date d'inscription dimanche 27 novembre 2005 Statut Membre Dernière intervention 15 janvier 2024 22
17 oct. 2008 à 05:58
Encore et toujours jipicy. Merci enormément. Avant de poster j'avais regardé du cote de SORT ,UNIQ etc.. mais je n'arrivrais pas a trouver l'association . Je teste.
1