Hi,
I have inserted a pipe-delimiter at certain positions in text file, but i want to skip the first line from inserting the pipe-delimiters, and on creation of new text file copy the first line from there.
Please some one help me.
$path ="c:\sample.txt"
Get-Content $Path
$NewPath="C:\New sample.txt"
$Positions=@(9,18,26,39,45,55,57)
$dat = Get-Content $path
ForEach ($Line in $Dat)
{
For($I=$Positions.Count-1;$I -GE 0;$I--)
{
$Line=$Line.Insert($Positions[$I],"|")
}
Add-Content $NewPath $Line
}