Forked from GeoffreyPlitt/convert_url_files_to_bookmarks.sh
Created
November 22, 2023 11:39
-
-
Save nixinator/94c3a02783abfddf7df25a29b5689bb3 to your computer and use it in GitHub Desktop.
Convert a folder of .URL files to a bookmarks.html file that can be imported into a browser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Run this script in a folder full of ".url" files, and pipe output to an HTML file. | |
# Example: ./convert_url_files_to_bookmarks.sh > bookmarks.html | |
echo "<!DOCTYPE NETSCAPE-Bookmark-file-1>" | |
echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">' | |
echo '<TITLE>Bookmarks</TITLE>' | |
echo '<H1>Bookmarks</H1>' | |
echo '<DL><p>' | |
ls -1 *.url | | |
sed 's/.url//' | | |
while read L; do | |
echo -n ' <DT><A HREF="'; | |
cat "$L.url" | grep URL | grep -v BASEURL | sed 's/URL=//' | tr -d '\r'| tr -d '\n'; echo '">'"$L"'</A>'; | |
done | |
echo "</DL><p>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment