I'm new to sed
, I'm trying to insert the content of a BFile into the file AFile, BEFORE a pattern (in AFile)
Hereafter's what I've tried :
sed -i '/blah Blah/r BFile' AFile
: it's inserting the content of BFile AFTER the pattern in AFile.
sed -i '/blah Blah/i BFile' AFile
: it's inserting the string 'BFile' BEFORE the pattern in AFile.
... hmmm
I'm conscious it's because of a wrong comprehension of regexp or sed
: I can't understand how the /i
and /r
work here... I can't find any help in sed --help
Anyone understanding my point ?
Regards,
Stan