Reputation: 51
I am trying to change the copyrights in a repository, i mean change the old copyrights to new copyrights for example copyrights 2008 to copyrights 2012,
so what i want to do is to find,
I was able to achieve
questions 2 by using grep -vir copyright *
, and
question 3 by using grep -rni copyright *
how do I list out all the files with 2 copyrights in them?
Upvotes: 1
Views: 360
Reputation: 753465
Presumably 3, 4, or more copyrights are as troublesome as 2?
You can use grep
to count, and then again to filter out the counts of 1:
grep -irc copyright * | grep -v '^ *1 '
Upvotes: 2
Reputation: 10550
Use xargs
to get the number of copyright lines for all files:
ls * | xargs -I % sh -c "echo %; grep -c 'copyright' %"
Upvotes: 0