Как искать и заменять несколько слов за один раз

Todos los shells que probé leen un documento aquí -bien incluso sin el terminador, el documento aquí -simplemente terminará al final -del archivo -. Bash da una advertencia sobre esto, pero busybox/dash/ksh y zsh simplemente lo manejan en silencio.

Por ej.

$ cat heredoctest.sh
#!/bin/bash
cat -n <<EOF
foo
bar
$ bash heredoctest.sh
heredoctest.sh: line 4: warning: here-document at line 2 delimited by end-of-file (wanted `EOF')
     1  foo
     2  bar

Pero la muestra particular de código que presentas parece un error. Tal como está escrito, simplemente agregaría la declaración if -a myPath/myFile.append, lo que no parece muy útil. Parece que el contenido del documento aquí -y el terminador simplemente faltan entre caty if.

1
18.07.2019, 00:49
1 ответ

Вы можете объединить несколько sedвыражений, подобных этому:

sed -e 's/Sat/Saturday/g' -e 's/Sun/Sunday/g' <file>

Это заменит все вхождения Satна Saturdayи все вхождения Sunна Sunday.

1
27.01.2020, 23:41

Теги

Похожие вопросы