Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

初识 sed 和 gawk #21

Open
ryosukeeeeee opened this issue Jul 14, 2022 · 2 comments
Open

初识 sed 和 gawk #21

ryosukeeeeee opened this issue Jul 14, 2022 · 2 comments

Comments

@ryosukeeeeee
Copy link
Member

https://archlinuxstudio.github.io/ShellTutorial/#/shellAdvanced/sed_gawk_basic

Linux命令行与Shell脚本教程 包含常见命令行使用,Bash基础、进阶编程,以及实用范例!

@2017libin
Copy link

在替换标记介绍时,这一段话好像不太正确:“p,表明原先行的内容要打印出来;”。这里应该是打印出来修改后的行,配合-n使用可以只查看修改后的行。我运行命令 sed -n 's/dog/cat/p' test,输出了 cat1。当p单独使用时,才会是打印原先行的内容。并且打印的内容是在寻址范围内的行,例如 sed -n 'p' test 会打印所有的行。而 sed -n '1,3p' test 只会打印第1到第3行。

@ryosukeeeeee
Copy link
Member Author

@2017libin 你所指出的地方 含义为p会将被修改行的原有内容一并输出 描述并无错误

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants