[英]awk How to extract information from html tag
我希望FS能夠<......>
點是任何東西。 所以,如果我讓我們說
<td width="50%" valign="top">System Hardware</td>
我想提取System Hardware
。 我嘗試了兩件事,但它不起作用。
awk -F "\\<([^>]+)\\>" '{print $1}' test.txt
awk -F "\\<?*\\>" '{print $1}' test.txt
在這兩種情況下,我什么都沒得
你什么也沒得到,因為你告訴awk打印$ 1,這將是第一個字段分隔符之前的字段。 你想print $2
。
$ awk -F'<[^>]+>' '{print $2}' file
System Hardware
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.