I have to add compiler directives before class declaration like :
`ifndef MIPI_RFFE_SCOREBOARD__SV
`define MIPI_RFFE_SCOREBOARD__SV
class mipi_rffe_scoreboard extends uvm_scoreboard;
I tried :
sed 's/class (\w+)(.*)/\`ifndef \U\1__SV\2/' mipi_rffe_scoreboard.sv
Which gives :
sed: -e expression #1, char 38: invalid reference \2 on `s' command's RHS
I have seen Using sed, Insert a line below (or above) the pattern?. Here Kamal's answer solves only the part of the problem as I need to capture "mipi_rffe_scoreboard" and change it to uppercase