Diewuxi

Belive tomorrow will be better, love science and technology, support communication and understanding, always ready for thought turn.

Blog / engineering_technology / computer / software / posix_program / sed / Sed 笔记

Blog


Article^ Parent

Sed 笔记


Date: 2020-02-22 00:00:00
Description: Sed 使用笔记。
Keywords: Sed, 行号, DOS 格式
Category: engineering_technology/computer/software/posix_program/sed
Tag: sed
Link: https://www.diewuxi.com/blog/article/97.html

Changelog

* 2023-06-17
    * Add: Dos, unix format problem.
* 2020-09-06
    * Add: Add -n option
* 2020-02-22
    * Add: Print line number
                        

Print match line line number

sed -n -e "/<pattern>/=" <file>
                        

Option -n

if set, only output pattern space when use p.

Note: When use -i option, don't use -n, because you will lose other content.

Dos, unix fomat problem

/M3$/ will not match if file format is DOS, so the file need converted to unix format.

Last modified: 2023-06-17

Comments [0]

There is no comments now.

Write comment(* is necessary, and email is not shown to public)


Diewuxi 2017--2024