小编noo*_*oob的帖子

使用 bash 解析 HTML 表格列

我正在尝试从 HTML 表格中提取 3 列。我需要添加主机名、产品+区域和日期。所以它们是第 1、3、4 列。

<div class="table sectionedit2">
  <table class="inline">
    <tr class="row0">
      <th class="col0 centeralign">hostname</th>
      <th class="col1 centeralign">AKA (Client hostname)</th>
      <th class="col2 leftalign">Product + Region</th>
      <th class="col3 centeralign">date added</th>
      <th class="col4 centeralign">  decom. date  </th>
      <th class="col5 centeralign">           builder           </th>
      <th class="col6 centeralign">  build cross-checker  </th>
      <th class="col7 leftalign"> <strong>decommissioner</strong></th>
      <th class="col8 centeralign">customer managed filesystems</th>
      <th class="col9 centeralign">  only company has root?  </th>
    </tr>
    <tr class="row1">
      <th class="col0 centeralign">HostName01</th>
      <td class="col1 leftalign">Host01</td>
      <td class="col2 leftalign">EU</td>
      <td class="col3 centeralign">2007-01-01</td> …
Run Code Online (Sandbox Code Playgroud)

xml bash xpath html-parsing xmllint

4
推荐指数
1
解决办法
3223
查看次数

标签 统计

bash ×1

html-parsing ×1

xml ×1

xmllint ×1

xpath ×1