F
F
fokin_nikolay19892016-05-25 11:54:52
linux
fokin_nikolay1989, 2016-05-25 11:54:52

Find text in file and output to file?

Look, in principle, I found an option for an example
find /home/[email protected]/.mozilla/firefox/*.default/ places.sqlite >> log.log
So it outputs to a file all the sites that were visited by the user and the number of times
Now the most begins interesting
in the home section is [email protected] [email protected], etc. about 1000 users
, it needs to go through all users, read the places.sqlite file and search for the address odnoklassniki.ru vk.com and write it to a separate log file for example rezult.log with the content
[email protected]
2 vk.com
15 odnoklassniki.ru
[email protected]
3 vk.com
1 odnoklassniki.ru
etc
Please help me implement

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Sukhov, 2016-06-20
@TovarischSuhov

for i in $(ls /home);do
echo $i >> result.log
find /home/[email protected]/.mozilla/firefox/*.default/ places.sqlite > /tmp/log.log
grep 'vk. com' /tmp/log.log >> result.log
grep 'odnoklassniki.ru' /tmp/log.log >> result.log
done

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question