ab52
1
Hi All
I need to add a line to a file but after a certain block of text is found
The block of text looks like this
<RDF:Description RDF:about="urn:mimetype:video/quicktime"
NC:value="video/quicktime"
and i need to add this in the next line down ( note there is already something there so it need to be pushed down a line)
NC:useSystemDefault="true"
many thanks
A
sed, ok?
sed '/NC:value="video/a NC:useSystemDefault="true"' file
ab52
3
sed it fine, i have not used it before like this, can explain what is it doing?
cat file1
abcd
efgh
<RDF:Description RDF:about="urn:mimetype:video/quicktime"
NC:value="video/quicktime"
ijkl
perl -pe 's!(NC:value="video/quicktime")!$1\nNC:useSystemDefault="true"!' file1
abcd
efgh
<RDF:Description RDF:about="urn:mimetype:video/quicktime"
NC:value="video/quicktime"
NC:useSystemDefault="true"
ijkl
/NC:value="video/ ==> If this pattern is found
a ==> Append in the line next to the pattern
NC:useSystemDefault="true" ==> With this text