Skip to content

in-place option uses different format #425

@PranavRJoshi

Description

@PranavRJoshi

In GNU sed, the in-place options supports the following format:

$ sed -i script file                              # no backup file produced
$ sed --in-place script file                      # no backup file produced
$ sed -i[SUFFIX] script file                      # backup file of form: file[SUFFIX]
$ sed --in-place=[SUFFIX] script file             # backup file of form: file[SUFFIX]

The current argument parsing function, however, consumes the successive argument for in-place option without checking the form. This is also mentioned in #229.

$ cat temp
quick brown fox

$ ./target/release/sed -i 's/fox/vox/' temp
sed: <script argument 1>:1:1: error: undefined label `emp'

$ sed -i 's/fox/vox/' temp 

$ cat temp
quick brown vox

$ sed -i.bak 's/vox/fox/' temp

$ ls -1
temp
temp.bak

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions