user7144720
user7144720

Reputation: 101

Read .ods file and open the link in the browser

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.

Upvotes: 0

Views: 269

Answers (1)

luantkow
luantkow

Reputation: 2959

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

Upvotes: 0

Related Questions