我正在將我的書籤從kippt.com移動到pinboard.in。移動awk文件中的數據塊
我從Kippt導出了我的書籤,由於某種原因,它們在同一字段中存儲了標籤(前面加了#)和說明。插件板將標記和說明分開。
這是一個Kippt書籤貌似出口後:
這是它應該看起來像導入到插件板之前什麼:
<DT><A HREF="http://www.example.org/" ADD_DATE="1412337977" LIST="Bookmarks" TAGS="tag1,tag2">This is a title</A>
<DD>This is a description
所以基本上,我需要更換#tag1 #tag2
TAGS="tag1,tag2"
並在<A>
的第一行上移動它。
我一直在閱讀有關搬到這裏來的數據塊:sed or awk to move one chunk of text betwen first pattern pair into second pair?
我一直沒拿出一個好的食譜至今。任何見解?
編輯:
這裏是什麼樣的輸入文件看起來像(3項總分3500)的實際例子:
<DT><A HREF="http://phabricator.org/" ADD_DATE="1412973315" LIST="Bookmarks">Phabricator</A>
<DD>#bug #tracking
<DT><A HREF="http://qz.com/261426/the-hidden-commands-for-diagnosing-and-improving-your-netflix-streaming-quality/" ADD_DATE="1412838293" LIST="Inbox">The hidden commands for diagnosing and improving your Netflix streaming quality – Quartz</A>
<DT><A HREF="http://www.farmholidays.is/" ADD_DATE="1412337977" LIST="Bookmarks">Icelandic Farm Holidays | Local experts in Iceland vacations</A>
<DD>#iceland #tour #car #drive #self Self-driving tour of Iceland
是否必須使用'awk' /'sed'或者例如'python'可能嗎? – 2014-10-11 22:04:15
它可能是Python,我開始學習。它可能是另一種語言(Ruby等),但我想學習一種我已經知道的語言:-)謝謝。 – 2014-10-11 22:17:16
在你的例子中,'