0

I have a .ods file in which it has 150 links.I need to check whether all the links are working or not.How can I achieve this using code.I dont want to do it manually.

user7144720
  • 101
  • 1
  • 2
  • 8

1 Answers1

0

Unpack Your ods file (it's a zip archive) and run following script (lets call it linkFinder):

#!/bin/bash
urls=$(for f in `find -type f`; do grep xlink:href=\"[^\"]*\" -o $f | cut -c 13- | sed 's/.$//'; done);

for url in $urls;
do
  wget -q --spider $url;
  if [ $? -eq 0 ]; then
    echo $url works
  else
    echo $url broken
  fi
done

Example:

$ ./../linkFinder.sh 
http://google.pl/ works
http://notexistingdomainforreal.com/ broken
luantkow
  • 2,809
  • 20
  • 14