Trie par date et par url d'un fichier
pcsystemd
Messages postés
734
Statut
Membre
-
pcsystemd Messages postés 734 Statut Membre -
pcsystemd Messages postés 734 Statut Membre -
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
--
L'accès au savoir est la première liberté que chaque homme devrait avoir.
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
--
L'accès au savoir est la première liberté que chaque homme devrait avoir.
Configuration: Linux Mozilla 1.9.0.1
2 réponses
-
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]$;-))
-
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.