S
Subra
Hi,
I have to replace the strings "LINUX", "__linux__", "linux" with
"__linux". Please help me to correct the below script.
My input file is of type below
#ifdef LINUX
DO SOME THING
#end if
#ifdef __linux
DO SOME THING
#endif
#ifdef linux
DO SOME THING
#endif
#ifdef __linux__
DO SOME THING
#endif
My o/p file should be
#ifdef __linux
DO SOME THING
#end if
#ifdef __linux
DO SOME THING
#endif
#ifdef __linux
DO SOME THING
#endif
#ifdef __linux
DO SOME THING
#endif
My script (Which needs correction)
#!/tools/opt/bin/perl
$fileCount = 0;
while($fileCount <= @ARGV-1)
{
open(FileHandle,$ARGV[$fileCount]) || die ("File not present
$ARGV[$fileCount]");
open(OpFile,">OpFile.$ARGV[$fileCount]") || die ("OpFile not
present");
while($line=<FileHandle>)
{
#$line=~s/(^#.*)LINUX(.*)/$1__linux$2/g;
$line=~s/(^#.*)linux(.*)/$1__linux$2/g;
#$line=~s/(^#.*)__linux__(.*)/$1__linux$2/g;
print OpFile $line;
}
close(FileHandle);
$fileCount++;
}
I have to replace the strings "LINUX", "__linux__", "linux" with
"__linux". Please help me to correct the below script.
My input file is of type below
#ifdef LINUX
DO SOME THING
#end if
#ifdef __linux
DO SOME THING
#endif
#ifdef linux
DO SOME THING
#endif
#ifdef __linux__
DO SOME THING
#endif
My o/p file should be
#ifdef __linux
DO SOME THING
#end if
#ifdef __linux
DO SOME THING
#endif
#ifdef __linux
DO SOME THING
#endif
#ifdef __linux
DO SOME THING
#endif
My script (Which needs correction)
#!/tools/opt/bin/perl
$fileCount = 0;
while($fileCount <= @ARGV-1)
{
open(FileHandle,$ARGV[$fileCount]) || die ("File not present
$ARGV[$fileCount]");
open(OpFile,">OpFile.$ARGV[$fileCount]") || die ("OpFile not
present");
while($line=<FileHandle>)
{
#$line=~s/(^#.*)LINUX(.*)/$1__linux$2/g;
$line=~s/(^#.*)linux(.*)/$1__linux$2/g;
#$line=~s/(^#.*)__linux__(.*)/$1__linux$2/g;
print OpFile $line;
}
close(FileHandle);
$fileCount++;
}