filelines.dll-Help.xml

<?xml version="1.0" encoding="utf-8"?>
 
<helpItems xmlns="http://msh" schema="maml">
 
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">
<!--Generated by Help Cmdlet Editor-->
    <command:details>
        <command:name>Set-Lines</command:name>
        <maml:description>
            <maml:para>Set any text files to a fixed number of lines and optionally remove blank lines.</maml:para>
        </maml:description>
                   <!--Add copyright info here.-->
                <maml:copyright><maml:para>Copyright Sea Star Development 2013</maml:para></maml:copyright>
        <command:verb>Set</command:verb>
        <command:noun>Lines</command:noun>
        <!--Add Dev version info here.-->
        <dev:version><maml:para>1.0.2.6</maml:para></dev:version>
    </command:details>
    <maml:description>
    <!--This is the Description section-->
        <maml:para>The Set-Lines Cmdlet will maintain any text or log file to a fixed length and also optionally remove any blank lines. Transcript files may also be formatted but only if the current session is not transcribing (achieved with the Stop-Transcript command). Needs Administrator account.</maml:para>
                <maml:para>In order to remove blank lines only, each individual file can be suffixed with '|0' or, if they are input via the pipeline, the -BLANK switch will perform that option for each one. See the example section for exact details.</maml:para>
                <maml:para>The progress bar will give a continuous display of the number of blank lines found and also whether they are being removed.</maml:para>
                <maml:para>*Important: any filepath containing the word 'transcript' will be formatted using Unicode rather than the default type, so ensure that these originate from the PowerShell console. Conversely any PS console files not so named will not be formatted correctly.</maml:para>
    </maml:description>
    <command:syntax>
             <command:syntaxItem>
            <maml:name>Set-Lines</maml:name>
 
            <command:parameter required = "true" variableLength = "false" globbing = "false" pipelineInput = "true" position = "named">
                <maml:name>Filepath</maml:name>
                    <command:parameterValue required="true" variableLength = "false" >String</command:parameterValue>
            </command:parameter>
 
            <command:parameter required = "false" variableLength = "false" globbing = "false" pipelineInput = "false" position = "named">
                <maml:name>Blanks</maml:name>
            </command:parameter>
 
            <command:parameter required = "false" variableLength = "false" globbing = "false" pipelineInput = "false" position = "named">
                <maml:name>Hide</maml:name>
            </command:parameter>
 
            <command:parameter required = "false" variableLength = "false" globbing = "false" pipelineInput = "false" position = "named">
                <maml:name>WhatIf</maml:name>
            </command:parameter>
 
            <command:parameter required = "false" variableLength = "false" globbing = "false" pipelineInput = "false" position = "named">
                <maml:name>Confirm</maml:name>
            </command:parameter>
        </command:syntaxItem>
    </command:syntax>
    <command:parameters>
 
        <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true" position="1" aliases="">
            <maml:name>Filepath</maml:name>
            <maml:description>
                <maml:para>The full path of the file to be processed followed by '|' and then 0 or the number of lines for the file length.</maml:para>
            </maml:description>
            <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
            <dev:type>
                <maml:name>String</maml:name>
                <maml:uri/>
            </dev:type>
            <dev:defaultValue>None</dev:defaultValue>
        </command:parameter>
 
        <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="">
            <maml:name>Blanks</maml:name>
            <maml:description>
                <maml:para>Remove all blank lines from any files in the input stream.</maml:para>
            </maml:description>
            <dev:type>
                <maml:name>SwitchParameter</maml:name>
                <maml:uri/>
            </dev:type>
            <dev:defaultValue>False</dev:defaultValue>
        </command:parameter>
 
        <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="quiet">
            <maml:name>Hide</maml:name>
            <maml:description>
                <maml:para>(Alias quiet) Suppress the progress bar. This works in exactly the same way as the $progressPreference variable.</maml:para>
            </maml:description>
                        <dev:type>
                <maml:name>SwitchParameter</maml:name>
                <maml:uri/>
            </dev:type>
            <dev:defaultValue>False</dev:defaultValue>
        </command:parameter>
                 
        <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="">
            <maml:name>WhatIf</maml:name>
            <maml:description>
                <maml:para>(Alias wi) Indicates what action will be performed without actually performing it. The cmdlet is not run.</maml:para>
            </maml:description>
            <dev:type>
                <maml:name>SwitchParameter</maml:name>
                <maml:uri/>
            </dev:type>
            <dev:defaultValue></dev:defaultValue>
        </command:parameter>
 
        <command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="">
            <maml:name>Confirm</maml:name>
            <maml:description>
                <maml:para>(Alias cf) Issues a prompt before continuing with the operation.</maml:para>
            </maml:description>
            <dev:type>
                <maml:name>SwitchParameter</maml:name>
                <maml:uri/>
            </dev:type>
            <dev:defaultValue></dev:defaultValue>
        </command:parameter>
    </command:parameters>
 
    <command:inputTypes>
        <command:inputType>
            <dev:type>
                <maml:name></maml:name>
                <maml:uri/>
                <maml:description>
                    <maml:para></maml:para>
                </maml:description>
            </dev:type>
            <maml:description></maml:description>
        </command:inputType>
    </command:inputTypes>
    <command:returnValues>
        <command:returnValue>
            <dev:type>
                <maml:name></maml:name>
                <maml:uri/>
                <maml:description>
                    <maml:para></maml:para>
                </maml:description>
            </dev:type>
            <maml:description></maml:description>
        </command:returnValue>
    </command:returnValues>
    <command:terminatingErrors>
    </command:terminatingErrors>
    <command:nonTerminatingErrors>
    </command:nonTerminatingErrors>
    <maml:alertSet>
        <maml:title></maml:title>
        <maml:alert>
            <maml:para>The format of each Filepath input parameter is the full path together with the number of desired lines for that file, ie "c:\thisfile.txt|1500" will set the line limit to 1500 (Note the separator before the digits is the same as the PowerShell 'Pipe').
Any deviation from this pattern will generate a probably confusing error message indicating the expected input. This must be corrected before the cmdlet will execute. Either upper or lower case may be used.
In order to have any blank lines removed from any file use the suffix '|0', ie 'c:\thisfile.txt|0'. Either text or log files will be accepted. Files of less than 10 lines will not be processed.</maml:para>
                        <maml:para>If the pipeline input contains a mixture of the 2 previous examples, use the -BLANKS switch to remove blank lines from all of the files.
In order to suppress the progress bar, use the -HIDE (alias -QUIET) switch, which is similar to setting $ProgressPreference = SilentlyContinue. The progress bar will never appear for files of less than 100 lines.
The cmdlet can be used in background jobs where this feature can be useful as in this sample script below. All ouput, including the Progress Bar (unless the -HIDE switch has been used), will still be displayed at the console:</maml:para>
<maml:para>
   Stop-Transcript | Out-Null
   $argumentList = 'd:\scripts\Transcript.txt|1500', '-BLANKS', '-HIDE'
   $scriptBlock = {param([string]$Arg1, [string]$Arg2, [string]$Arg3)
      Invoke-Expression -Command "Set-Lines $Arg1 $Arg2 $Arg3"}
   Start-Job -Name Job1 -ScriptBlock $scriptBlock -argumentList $argumentList | Wait-job | Receive-Job
Start-Transcript -Append | Out-Null
    
</maml:para>
        </maml:alert>
    </maml:alertSet>
    <command:examples>
 
              <command:example>
            <maml:title>
-------------- Example 1: input a single file. -------------- </maml:title>
            <maml:introduction>
                <maml:para>C:\PS&gt;</maml:para>
C:\PS&gt; </maml:introduction>
              <dev:code>Set-Lines "d:\scripts\summary.log|1000"</dev:code>
              <dev:remarks>
                <maml:para>This will limit the file to 1000 lines length and not remove blank lines. Use quotes if there are spaces or to include something like "$pwd\myfile.txt|2000".</maml:para>
                <maml:para></maml:para>
                <maml:para></maml:para>
                <maml:para>PS D:\Scripts&gt; set-lines "d:\scripts\summary.log|1000"
16/01/2014 21:14:27 Starting maintenance on file &lt;D:\Scripts\summary.log&gt;
16/01/2014 21:14:32 Maintenance of file completed: 13 lines removed.
                </maml:para>
                <maml:para></maml:para>
              </dev:remarks>
            <command:commandLines>
                <command:commandLine>
                    <command:commandText>
                    </command:commandText>
                </command:commandLine>
            </command:commandLines>
        </command:example>
 
        <command:example>
            <maml:title>
-------------- Example 2: using pipeline input. -------------- </maml:title>
            <maml:introduction>
                <maml:para>C:\PS&gt;</maml:para>
C:\PS&gt; </maml:introduction>
              <dev:code>"$pwd\ipconfig.log|1500","$pwd\transcript.txt|0" | Set-Lines</dev:code>
              <dev:remarks>
                <maml:para>Remove all but the last 1500 lines from ipconfig.txt and all blank lines from transcript.txt. A warning will be generated and the latter file skipped if Stop-Transcript has not been entered.</maml:para>
                <maml:para></maml:para>
                <maml:para></maml:para>
                <maml:para>PS D:\Scripts&gt; "$pwd\ipconfig.log|1500","$pwd\transcript.txt|0" | set-lines
16/01/2014 21:14:27 Starting maintenance on file &lt;D:\Scripts\ipconfig.log&gt;
16/01/2014 21:14:32 Maintenance of file completed: 504 lines removed.
16/01/2014 21:14:33 Starting maintenance on file &lt;D:\Scripts\transcript.txt&gt;
16/01/2014 21:14:40 Maintenance of file completed: 81 blank lines removed.
                </maml:para>
                <maml:para></maml:para>
              </dev:remarks>
            <command:commandLines>
                <command:commandLine>
                    <command:commandText>
                    </command:commandText>
                </command:commandLine>
            </command:commandLines>
        </command:example>
 
        <command:example>
            <maml:title>
-------------- Example 3: using the Blanks parameter. -------------- </maml:title>
            <maml:introduction>
                <maml:para>C:\PS&gt;</maml:para>
C:\PS&gt; </maml:introduction>
              <dev:code>Set-Lines "c:\documents\file.txt|500" -Blanks</dev:code>
              <dev:remarks>
                <maml:para>Remove all but the last 500 lines of the file including any blank lines. Note that blanks will be removed from the 500 lines, leaving a lower number.</maml:para>
                <maml:para></maml:para>
                <maml:para></maml:para>
                <maml:para>PS D:\Scripts&gt; set-lines "c:\documents\file.txt|500" -Blanks
16/01/2014 21:18:23 Starting maintenance on file &lt;c:\documents\file.txt&gt;
16/01/2014 21:18:30 Maintenance of file completed: 19 lines removed (+ 8 blank).
                </maml:para>
                <maml:para></maml:para>
              </dev:remarks>
            <command:commandLines>
                <command:commandLine>
                    <command:commandText>
                    </command:commandText>
                </command:commandLine>
            </command:commandLines>
        </command:example>
 
    </command:examples>
    <maml:relatedLinks>
        <maml:navigationLink>
            <maml:linkText>http://www.SeaStar.99k.org</maml:linkText>
            <maml:uri></maml:uri>
        </maml:navigationLink>
    </maml:relatedLinks>
</command:command>
</helpItems>