sed on mac: 'extra characters after p command'

julius

On Linux I use this to get the next two lines after the [test] line:

sed -n '/\[test\]/{n;p;n;p}' my-file

On Mac I get:

sed: 1: "/\\[test\\]/{n;p;n;p}": extra characters at the end of p command.

Is there an expression that works on both platforms or on Mac a completely different command must be used?

Jean-François Fabre

Add an extra semi-colon after the last p

 sed -n '/\[test\]/{n;p;n;p;}' my-file

(not related to Mac version, also fails on MSYS)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

sed error complaining "extra characters after command"

From Dev

sed: -e expression #1, char 10: extra characters after command

From Java

How to fix sed command on MacOS with error extra characters after \ at the end of c command?

From Dev

why "extra characters after command" error shown for the sed command line shown?

From Dev

sed extra characters at end of l command

From Dev

BSD sed: extra characters at the end of d command

From Dev

Sed - How do I remove the extra characters that show up after running the command?

From Dev

Sed matches unwanted extra characters

From Dev

Insert multi lines after match using Mac's sed command

From Dev

Sed command filtering extra text/removing

From Dev

Replace characters after match with sed

From Dev

sed: !p command strange behavior

From Dev

strings command printing some extra characters

From Dev

Extra characters in XML file after XDocument Save

From Dev

Android:ellipsize end - Extra Characters after Ellipsis

From Dev

extra characters after close-brace

From Dev

sed command does not work for certain characters in unix

From Dev

What is the purpose of those special characters in the sed command?

From Dev

fedora sed command replace special characters

From Dev

Sed command for deleting an inclusive range of characters

From Dev

sed command to delete a string containing / ,\ characters

From Dev

(Sed) Search/Replace Involving Negative Number Yields Extra Characters

From Dev

porting sed command from linux to mac

From Dev

sed command to replace a string with special characters with another string with special characters

From Dev

Why is an extra space getting removed in sed substitution command

From Dev

SED: Appending extra bytes after a specific byte position

From Dev

tcl error extra characters after close-brace while executing for

From Dev

TCL factorial calculation code: extra characters after close-brace

From Java

How to add characters in word and replace it using sed command in linux

Related Related

  1. 1

    sed error complaining "extra characters after command"

  2. 2

    sed: -e expression #1, char 10: extra characters after command

  3. 3

    How to fix sed command on MacOS with error extra characters after \ at the end of c command?

  4. 4

    why "extra characters after command" error shown for the sed command line shown?

  5. 5

    sed extra characters at end of l command

  6. 6

    BSD sed: extra characters at the end of d command

  7. 7

    Sed - How do I remove the extra characters that show up after running the command?

  8. 8

    Sed matches unwanted extra characters

  9. 9

    Insert multi lines after match using Mac's sed command

  10. 10

    Sed command filtering extra text/removing

  11. 11

    Replace characters after match with sed

  12. 12

    sed: !p command strange behavior

  13. 13

    strings command printing some extra characters

  14. 14

    Extra characters in XML file after XDocument Save

  15. 15

    Android:ellipsize end - Extra Characters after Ellipsis

  16. 16

    extra characters after close-brace

  17. 17

    sed command does not work for certain characters in unix

  18. 18

    What is the purpose of those special characters in the sed command?

  19. 19

    fedora sed command replace special characters

  20. 20

    Sed command for deleting an inclusive range of characters

  21. 21

    sed command to delete a string containing / ,\ characters

  22. 22

    (Sed) Search/Replace Involving Negative Number Yields Extra Characters

  23. 23

    porting sed command from linux to mac

  24. 24

    sed command to replace a string with special characters with another string with special characters

  25. 25

    Why is an extra space getting removed in sed substitution command

  26. 26

    SED: Appending extra bytes after a specific byte position

  27. 27

    tcl error extra characters after close-brace while executing for

  28. 28

    TCL factorial calculation code: extra characters after close-brace

  29. 29

    How to add characters in word and replace it using sed command in linux

HotTag

Archive