使用awk

时间:2018-08-07 14:55:50

标签: shell unix awk

在我的数据上使用awk,我得到以下结果:

命令:

$ awk '{split($8,INFO,";"); print $1"\t"$2"\t"INFO[8]}' data.txt

结果:

  

chr1 1115252246 VMF = 0.0426

     

chr1 115256495 VMF = 0.0574

     

chr1 115256536 VMF = 0.0465

     

chr1 115256579 VMF = 0.0574

我想使用相同的AWK代码从第三列中删除“ VMF =“字符串,并使用它:

  

chr1 115252246 0.0426

     

chr1 115256495 0.0574

     

chr1 115256536 0.0465

     

chr1 115256579 0.0574

谢谢!

1 个答案:

答案 0 :(得分:2)

在拆分和打印之间添加$getDisplayPage = " SELECT p.id as pageID, page_type_id, display_id, slide_order, duration, background_img, pn.ID as panel_id, panel_type_id, cont_id, c.ID as contID, content FROM pages p inner join panels pn on p.id = pn.page_id inner join content c on pn.cont_id = c.id WHERE p.active = 1 and pn.active = 1 AND p.display_id = '".$display."' "; $showDisplayResult = $mysqlConn->query($getDisplayPage); while($row=mysqli_fetch_assoc($showDisplayResult)) { $rows[$row['pageID']][] = $row; } $showDisplays = json_encode($rows);