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 Answers1

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
PiedPiper
  • 944