We have a ASCII art like the following
ART _____
ART | __ \
ART | |__) |__ ___ _ __
ART | ___/ _ \/ _ \ '__|
ART | | | __/ __/ |
ART |_| \___|\___|_|
ART
ART
We have a variable ${art}="123456" and want to replace ART with ${art}, so the system will print the standard output like this
123456 _____
123456 | __ \
123456 | |__) |__ ___ _ __
123456 | ___/ _ \/ _ \ '__|
123456 | | | __/ __/ |
123456 |_| \___|\___|_|
123456
123456
I have tried this as this post suggests
sed -i "s/ART/${art}/g" ascii-art
The following error message shows up:
sed: -e expression #1, char 6: unterminated `s' command
I am in Linux ip-10-22-37-149 4.4.8-20.46.amzn1.x86_64 #1 SMP Wed Apr 27 19:28:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux (Amazon EC2)
sed --version returns:
GNU sed version 4.2.1
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
to the extent permitted by law.
GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <[email protected]>.
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.
Any thoughts?
Thanks!
sed -i"" "s/ART/${art}/g" ascii-art- note the extra quotes after -i.$artcontains a/character. But123456shouldn't be a problem.-iand-i"". An empty string is simply removed by the shell.sed -i 's/ART/${art}/g' <filename>sed --versionto your post.