2

i am trying to add a new line to a file using sed :

sed -i '/<field name="Users" indexed="true"/>/a <copyField source="New_user" dest="text"/>' $RTDIR/schema.xml

i get an error: unknown command: `>'

how can i make it work? and also, the change will be permanent?

Thanks!

1
  • "I" is always uppercase on English.
    – peterh
    Nov 19 '17 at 6:47
0

You have a slash in your the target string. You need to escape it with '\' e.g.

sed -i '/<field name="Users" indexed="true"\/>/a <copyField source="New_user" dest="text"/>' $RTDIR/schema.xml

Not the answer you're looking for? Browse other questions tagged or ask your own question.