How to find duplicate lines in a connection text file
2 answers
I haven't tried this, but "Dupli Find" available at http://www.rlvision.com/dupli/about.asp may help you.
The powershell script window outlined at http://secretgeek.net/ps_duplicates.asp also helps you write your own tool.
There is also a scripting solution at http://www.microsoft.com/technet/scriptcenter/resources/qanda/aug05/hey0819.mspx
+2
source to share
cat file.js | grep -o "function\([[:space:]]\+[a-zA-Z0-9_]\+\)\?[[:space:]]*(" | sort | uniq -c | sort -n
What reads:
- Cat file
- Find function definitions (function-ws-name-ws-paren) -o only fetches the relevant parts of the lines (i.e. only the definitions themselves)
- sort (for next step)
- Read the same sequential lines (uniq removes duplicates, -c adds count)
- sort by number of matches so that duplicates (if they appear last)
You can filter out non-duplicates, but it's easier to just sort so they come first.
Edit Modified regex to include anonymous functions
0
source to share