i have a minified javascript file using r.js, i need to put the entire content of the file in another java file around the line 19, so i try this commands (Mac):
SRC_FILE=`cat ./javascript.minify.js`
sed "19s/.*/${SRC_FILE}/g" ./Original.java > ./Replace.java
the result of this command:
bad flag in substitute command: 'o'
so i try with perl:
SRC_FILE=`cat ./javascript.minify.js`
cat Original.java | perl -p -e "s/.*/'${SRC_FILE}'/g if $.==19" > ./Replace.java
the result of this command:
Bareword found where operator expected at -e line 1, near "bowels"
syntax error at -e line 1, near "bowels "
Can't find string terminator '"' anywhere before EOF at -e line 1.
how i can tell sed or perl that the replace is a string?
FIXED
the only way for this, is using base64:
SRC_FILE=`cat ./javascript.minify.js | base64`
sed "19s/.*/${SRC_FILE}/g" ./Original.java > ./Replace.java
thanks for your comments and everything