Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a folder with 1700+ hyperlinks using the proprietary .webloc format created by the anti-standardizing Apple OS. I want to run a script which converts the lines to the standard format so that they will also run when clicked on a Unix, Linux, or TrueOS/FreeBSD/OpenBSD system. Search engines rewrite my request to do the opposite, or show me ways to wrap a webloc inside HTML tags. I'm on a GNU development critical path so help is greatly appreciated.

Converts file

AlternativeNews.com - The Independent News Source for Free-Thinking People.webloc
BRAINFEED.TV - Reclaim Your Brain!.webloc

to

http://alternativenews.com/
http://brainfeed.tv/

What I have tried:

I've searched but search engines reverse what I want to do or want to wrap the webloc in HTML tags.
Posted
Updated 6-Nov-22 8:58am
Comments
Richard MacCutchan 25-Oct-18 4:14am    
I would most probably use awk: capture each string, split on spaces and add the prefix and suffix characters.
Richard Deeming 25-Oct-18 12:46pm    
It looks like webloc files are simply XML files. You just need to parse the file contents and extract the value of the <string> element.

1 solution

From memory something like
Shell
# echo -en "https://"
# ls | awk -F' ' '{print $1}'
should work.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900