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
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:
- Trie par date et par url d'un fichier
- Url - Guide
- Fichier .dat - Guide
- Fichier bin - Guide
- Comment ouvrir un fichier epub ? - Guide
- Comment réduire la taille d'un fichier - Guide
2 réponses
Salut,
Essaie ça :
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]$ ;-))