Use zcat and sed or awk to edit compressed .gz text file

前端 未结 2 1028
梦如初夏
梦如初夏 2020-12-29 11:05

I am trying to edit compressed fastq.gz text files, by removing the first six characters of lines 2,6,10,14... I have two different ways of doing this right now, either usin

2条回答
  •  失恋的感觉
    2020-12-29 11:47

    I wrote a script called zawk which can do this natively. It's similar to glenn jackman's answer to a duplicate of this question, but it handles awk options and several different compression mechanisms and input methods while retaining FILENAME and FNR.

    You'd use it like:

    zawk 'awk logic goes here' log*.gz
    

    This does not address sed's "in-place" flag (-i).

提交回复
热议问题