Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to be able to search several thousand XHTML and XML files and see a list of files that do not contain the following string on the first line:

<?xml version="1.0" encoding="utf-8"?>

How would I go about doing this? I thought I could do this in Notepad++ using the Search in Files function, but I do not see any way to look for a string that is not found and/or properly formatted and have it output a list of files.

share|improve this question
1  
What operating system are you using any way? –  Angel Brighteyes Oct 11 '12 at 19:16

2 Answers 2

up vote 2 down vote accepted

Use Agent Ransack and set it to only search through .xml file types. If you know RegEx use that, I am at work or I would help with that. I believe Agent Ransack comes with the ability to just use a negative search but I'll have to check.

Agent Ransack has a "Specifies Not Expression" which will work for what you want, but you will need a regular expression match string in order to pull it off. If you are a developer it is a good skill to at least be pseudo familiar with enough to do some basic searches or text matching with.

[Edit] Agent Ransack does not have a "Not Expression" search ability. The RegEx was pretty simple though

(<\?xml version="1.0" encoding="utf-8"\?>)

I'll keep looking for a tool/utility app.

share|improve this answer

I know this is an old question, but I came here looking for the same information and thought I'd share a simpler solution using Agent Ransack, which does in fact allow you to specify a NOT condition. For the above question, using the following as the text to search for works perfectly, and the only necessary modification to the string in question is escaping the double quotes:

NOT "<?xml version=\"1.0\" encoding=\"utf-8\"?>"

Hope this helps someone else.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.