sed doesn't work in the real files but on the screen
I need to add in lines in front of and in end of all the .html files in a folder.
I tried these codes, however, nothing happened in those html files when I opened them with Text editor. I could only see what I want to print out on the Terminal window.And I 'm sure I run the script in the right place.
Any suggestion?
=====================================================================
#!/bin/bash
j=1
for i in *.html; do
if [[ $j -lt 8 ]]; then
< ${i} sed -n '
1i\
<DOC>\
<DOCNO>cc_1_${j}</DOCNO>
$i</DOC>\
'
fi
j=$(($j+1));
done
=====================================================================
|