sed extra characters at end of l command

Gerard van den Bosch

I am trying replace value in a config file with sed in cshell.

However it gives me the error:

sed: 1: "/usr/local/etc/raddb/mo ...": extra characters at the end of l command

I am trying the following command:

sed -i "s/private_key_password = .*/private_key_password = test/" /usr/local/etc/raddb/mods-available/eap

I have looked at examples of sed to do this but they all look similar with what I am doing, what is going wrong here?

Martin Tournoij

FreeBSD sed requires an argument after -i to rename the original file to. For example sed -i .orig 's/../../' file will rename he original file to file.orig, and save the modified file to file.

This is different from GNU sed, which doesn't require an argument for the -i flag. See sed(1) for the full documentation. This is one of those useful extensions to the POSIX spec which is unfortunately implemented inconsistently.

Right now, the "s/private_key_password = .*/private_key_password = test/" parts gets interpreted as an argument to -i, and /usr/local/etc/raddb/mods-available/eap gets interpreted as the command. Hence the error.

So you want to use:

sed -i .orig "s/private_key_password = .*/private_key_password = test/" /usr/local/etc/raddb/mods-available/eap

You can then check if the changes are okay with diff and remove /usr/local/etc/raddb/mods-available/eap.orig if they are.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

BSD sed: extra characters at the end of d command

From Java

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

From Dev

sed error complaining "extra characters after command"

From Dev

sed on mac: 'extra characters after p command'

From Dev

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

From Dev

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

From Dev

Sed matches unwanted extra characters

From Dev

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

From Dev

Extra characters added to end of string in c

From Dev

Android:ellipsize end - Extra Characters after Ellipsis

From Dev

Sed command filtering extra text/removing

From Dev

strings command printing some extra characters

From Dev

Removing characters at end of lines using find and sed

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

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

From Dev

How can I prevent extra characters at the end of my string in Regex?

From Dev

spring3 file upload and save - extra null characters at the end

From Dev

Excel 2016 - JSON web query - extra characters at the end of JSON input

From Dev

Why is an extra space getting removed in sed substitution command

From Dev

cat command appears to be adding extra $ character at the end of each line

From Dev

Bash sed: Replace all special characters (Invalid range end)

From Dev

How to add extra "end characters" to the "First sentence should end with a period." Checkstyle rule

From Java

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

From Dev

How can I escape special characters in a sed "sub-command"?

Related Related

  1. 1

    BSD sed: extra characters at the end of d command

  2. 2

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

  3. 3

    sed error complaining "extra characters after command"

  4. 4

    sed on mac: 'extra characters after p command'

  5. 5

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

  6. 6

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

  7. 7

    Sed matches unwanted extra characters

  8. 8

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

  9. 9

    Extra characters added to end of string in c

  10. 10

    Android:ellipsize end - Extra Characters after Ellipsis

  11. 11

    Sed command filtering extra text/removing

  12. 12

    strings command printing some extra characters

  13. 13

    Removing characters at end of lines using find and sed

  14. 14

    sed command does not work for certain characters in unix

  15. 15

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

  16. 16

    fedora sed command replace special characters

  17. 17

    Sed command for deleting an inclusive range of characters

  18. 18

    sed command to delete a string containing / ,\ characters

  19. 19

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

  20. 20

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

  21. 21

    How can I prevent extra characters at the end of my string in Regex?

  22. 22

    spring3 file upload and save - extra null characters at the end

  23. 23

    Excel 2016 - JSON web query - extra characters at the end of JSON input

  24. 24

    Why is an extra space getting removed in sed substitution command

  25. 25

    cat command appears to be adding extra $ character at the end of each line

  26. 26

    Bash sed: Replace all special characters (Invalid range end)

  27. 27

    How to add extra "end characters" to the "First sentence should end with a period." Checkstyle rule

  28. 28

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

  29. 29

    How can I escape special characters in a sed "sub-command"?

HotTag

Archive