mask_layout
Member level 2
I am replacing a single line text with multiple line text. I will be doing this for about a hundred files and I think its crazy to work on it 1by1.
Im new to shell scripting in unix and cant get the following command to work on replacing single line to multiple lines.
This is my sample INPUT FILE
NEW FILE I want to OUTPUT
Can somebody help me to get this working please?
Im new to shell scripting in unix and cant get the following command to work on replacing single line to multiple lines.
Code:
#!/usr/local/bin/tcsh
foreach file (*.TECH)
set newname=`basename $file .TECH`
mv $file $newname"_DFM.TECH"
end
foreach DFMfile (*_DFM.TECH)
cat $DFMfile | perl -pi -e "s/OneLinerOldText/NewMultipleLineText/g;" >$DFMfile
end
This is my sample INPUT FILE
block "xxx"
{
line1 = 0
line2 = 0
OneLinerOldText = 0
line3
line4 }
NEW FILE I want to OUTPUT
block "xxx"
{
line1 = 0
line2 = 0
NewMultipleLine1
NewMultipleLine2
NewMultipleLine3
line3
line4 }
Can somebody help me to get this working please?