sed notes

windows sed 类似工具

Cheat Sheet

多行处理

范围表示

  • "3,4a hello"
  • "3,$a hello"

    • $ –> 到行尾

insert 前面插入

  • sed -e "3i hello"

append 后面追加

  • sed -e "3a hello"

delete 删除

  • sed -e "3,5d"

change 修改

  • sed -e "3c hello" –> 修改成 hello

print 打印输出

  • sed -n "3,4p" —> 与 -n 连用

单行编辑

简单替换

  • sed -e "s/root/my-name/"

替换次数

  • sed -e "s/root/my-name/3"

全局替换

  • sed -e "s/root/my-name/3g"

支持正则 regex

  • echo "home/demo.ZIP" | sed -e "s\.ZIP$/.zip/3g"
  • 注意

find command notes

-type

  • 指定搜索结果类型
  • 可选值

    • d: directory 目录
    • f: file 文件

-name

指定搜索名称:

  • 可以使用通配符

eg:

1
2
find . -name "*public*" -type d
# result : ./public

相关命令

-iname

  • 忽略大小写

-regex

指定搜索名称:

xargs command notes

用途

  • 处理标准输出 stdout
  • 转化成合适的格式
  • 再传递给另一个命令

简单使用

1
find . -links 1 -type f |xargs ls -l
  • xargs 直接后跟命令

与 find -exec your_command {} \; 比较

xargs 更快速

xargs 一次传输所有参数

find -exec {} \; 一次传输一个参数

-t 打印 执行的命令

-p 打印 执行的命令 和 “执行的用户”

-I 执行多条命令

1
  cat foo.txt | xargs -I % sh -c 'echo %; mkdir %'
  • -I R your_command

Quantum Notes

教程

相关公司和机构

  • 中国

    • 本源量子,合肥

量子纠缠 Quantum Entanglement

  • 多个粒子

    • 相互作用

      • 强相互作用
    • 无法单独描述单个粒子性质
    • 只能描述整体系统的性质
  • 经典力学里,没有类似现象
  • 超距作用