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

Aaron Perry

I'm using sed to look in a text file and replace any values that match 999 with -999.

The problem I'm having is that the command is inserting WAY too many extra negative symbols...

Code:

sed -i "s/999/-999/g" /home/weather/data/.../master_tmp

Result:

------------------------------------------------------------------------------------------------------------------------------------------------999

Expected Result:

-999
Aaron Perry

Problem solved!

I had the sed command in a while/do/done loop...

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 matches unwanted extra characters

From Dev

sed error complaining "extra characters after command"

From Dev

sed on mac: 'extra characters after p command'

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: -e expression #1, char 10: extra characters after command

From Dev

Parse string to int when string contains a number + extra characters

From Dev

Parse string to int when string contains a number + extra characters

From Dev

Replacing a certain number of characters after a match using sed

From Dev

sed - Replace new line characters not followed by 5-digit number

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 - How do I remove the extra characters that show up after running the command?

From Dev

tmux on Windows Linux Subsystem yields spurious characters

From Java

Sed substitution with negative lookahead and negative lookbehind regex

From Dev

Inconsistent shell behavior involving endline characters

From Dev

Negative lookahead and negative lookbehind and multiple characters in PCRE

From Dev

Code is adding extra characters

From Dev

ObjectOutputStream writing extra characters

From Dev

Extra unexpected characters Perl

From Dev

Guid with extra characters issue

From Dev

Extra characters in bash array

From Dev

Wrap and remove extra characters

From Dev

Elimination of extra characters in a word

From Dev

head eats extra characters

From Dev

XMLHttpRequest returning extra characters

From Dev

extra characters in bash prompt

From Dev

Extra characters appear in `less`

From Dev

Reformatting negative numbers with sed or awk

Related Related

  1. 1

    Sed matches unwanted extra characters

  2. 2

    sed error complaining "extra characters after command"

  3. 3

    sed on mac: 'extra characters after p command'

  4. 4

    sed extra characters at end of l command

  5. 5

    BSD sed: extra characters at the end of d command

  6. 6

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

  7. 7

    Parse string to int when string contains a number + extra characters

  8. 8

    Parse string to int when string contains a number + extra characters

  9. 9

    Replacing a certain number of characters after a match using sed

  10. 10

    sed - Replace new line characters not followed by 5-digit number

  11. 11

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

  12. 12

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

  13. 13

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

  14. 14

    tmux on Windows Linux Subsystem yields spurious characters

  15. 15

    Sed substitution with negative lookahead and negative lookbehind regex

  16. 16

    Inconsistent shell behavior involving endline characters

  17. 17

    Negative lookahead and negative lookbehind and multiple characters in PCRE

  18. 18

    Code is adding extra characters

  19. 19

    ObjectOutputStream writing extra characters

  20. 20

    Extra unexpected characters Perl

  21. 21

    Guid with extra characters issue

  22. 22

    Extra characters in bash array

  23. 23

    Wrap and remove extra characters

  24. 24

    Elimination of extra characters in a word

  25. 25

    head eats extra characters

  26. 26

    XMLHttpRequest returning extra characters

  27. 27

    extra characters in bash prompt

  28. 28

    Extra characters appear in `less`

  29. 29

    Reformatting negative numbers with sed or awk

HotTag

Archive