I'm performing a link check on a site from a list of urls, and the only way I can think of is using wget: `wget --server-response -i inputfile 2> output` and then further parse the header response. This outputs a relatively large file for a large list, and I only want to know if a 404 is present. A typical response looks something like:

```
--2017-03-28 19:14:39--  https://www.example.com/foo/bar
Reusing existing connection to www.example.com:443.
HTTP request sent, awaiting response... 
  HTTP/1.1 404 NotFound
<snip>

```

How can I perform a regex match from the output by wget for each url (from stderr), and if a 404 is present output the url which I can then redirect to a file so I am left with a file that has a list of 404's? (Please don't suggest using curl, the site is unfortunately set up to return `METHOD NOT ALLOWED`.