Search code examples
ods

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.


Solution

  • 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