0

I'm trying to change few things in a file based on line numbers.

sed -n -i "$command|ABC|XYZ" ".$file_name"

The command variable is going to take the values such as 200s,311s and so on

I'm getting "sed: -e expression #1, char 32: unterminated `s' command"

What could be going wrong?

2
  • 1
    a missing | after XYZ ? Commented Sep 23, 2016 at 8:00
  • Thanks @oliv ! Its working now with your change. Commented Sep 23, 2016 at 9:18

1 Answer 1

1

you can try this;

sed -i "$command|ABC|XYZ|" ".$file_name"

you need to insert | after XYZ and delete -n option.

Sign up to request clarification or add additional context in comments.

2 Comments

Why change ".$file_name" for ${file_name} ? The OP may want to apply command on hidden file and filename should be quoted.
Thanks muzido and Kenavoz. It started working after the suggested change

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.