请注意:
$ diff <(echo a) <<<b
diff: missing operand after '/dev/fd/63'
diff: Try 'diff --help' for more information.
Run Code Online (Sandbox Code Playgroud)
我知道<(...)
效果很好:
$ diff <(echo a) <(echo b)
1c1
< a
---
> b
Run Code Online (Sandbox Code Playgroud)
我也知道<<<
一般情况下效果很好:
$ cat <<<a
a
Run Code Online (Sandbox Code Playgroud)
那么正确的调用方法是什么diff
?
观察:
mark@L-R910LPKW:~$ echo a b | xargs -d' ' -I{} bash -c 'echo {} 1'
a 1
b
bash: line 2: 1: command not found
mark@L-R910LPKW:~$
Run Code Online (Sandbox Code Playgroud)
到底是怎么回事?
我有一个文件,其中某些(不是所有)行看起来像这样:
Sequence: n
Run Code Online (Sandbox Code Playgroud)
我想n
用相应的行号替换。
我怎样才能用 sed 做到这一点?