Open Windows internet shortcut (*.url) files in firefox

 $ firefox $(cat file.url | grep -i ^url=* | cut -b 5-)

— by tsjswimmer on Sept. 11, 2014, 10:03 a.m.


Opens a .url file in Firefox which in the above example, is called file.url (Windows .url files are basically just text files, so they can be parsed with a few commands). In the above example, cat is used to load the file, grep is used to filter out unnecessary lines (the caret(^) should help remove those pesky "BASEURL" lines), and cut is used to remove the first five characters of the remaining line (which should be URL=), leaving only the web address (which should be everything from character 5 until the end of the line), which will be piped into Firefox.


This hack has not been tested with URL's which use "specail characters" (quotes, semi-colons, ect), except ampersands, percent signs, and question marks. Tested only on gnu/linux (using bash and sh).