copy lines containing word from one file to another file in linux

后端 未结 4 1765
南旧
南旧 2021-02-10 01:10

I want to copy lines containing certain words from file1 to file2.

Suppose file1:

ram 100 ct 50
gopal 200 bc 40
ra         


        
4条回答
  •  自闭症患者
    2021-02-10 01:40

    awk '$3=="ct"' file1 > file2
    

    This only filters lines where the third column must exactly match the string ct.

提交回复
热议问题