[Sunhelp] Adding a "*" character to specific lines in a data file
Walter Krumshyn
wallyk at nortelnetworks.com
Tue Mar 21 09:01:48 CST 2000
The following perl script would to the trick...
#!/usr/bin/perl
while(<>) {
if (!($counter++ % 4)) {
printf "*";
}
printf "$_";
}
Regards,
Walter
Sampath K Kari wrote:
>
> Dear experts,
>
> I am very beginner in scripting.
>
> Need ur help for a script that could do below:
>
> Input data file is a flat text file containing data in columns delimited
> by space.
>
> I need to insert a "*" character in the beginning of every 4th line
> starting from line 1 in a file. That means I need to insert in lines 1,
> 5, 9,13, 17, etc,, till the end of the file.
>
> Thanks in advance.
>
> -Sampath
>
> _______________________________________________
> SunHELP maillist - SunHELP at sunhelp.org
> http://www.sunhelp.org/mailman/listinfo/sunhelp
More information about the SunHELP
mailing list