I came across a matlab script which uses a perl script called replaceinfile.m which uses
perlCmd = sprintf('"%s"',fullfile('/usr/bin/perl'));
perlstr = sprintf('%s -i.bak -pe"s/%s/%s/g" "%s"', perlCmd, str1, str2,infile);
and wanted to use the replaceinfile function to replace multiple lines of text, e.g.:
Line1
Line2
Line3
Line4
becomes:
Line1
Line4
I tried
replaceinfile('Line2\r\nLine3\r\n','',inputfile,outputfile)
since there are 'CR LF' line endings in my input file but this doesn't work and I can't figure out what the correct regex is.
Any advice? Thanks!