Skip to content

Get‑TextOffset

viscalyxbot edited this page Feb 28, 2025 · 2 revisions

SYNOPSIS

Finds the start and end offsets of a given text within a file.

SYNTAX

Get-TextOffset [-FilePath] <String> [-TextToFind] <String> 
 [<CommonParameters>]

DESCRIPTION

Reads the content of a file and searches for the specified text. Returns the start and end offsets of the text within the file.

EXAMPLES

EXAMPLE 1

Get-TextOffset -FilePath 'C:\path\to\your\script.ps1' -TextToFind 'if ($condition) {'

PARAMETERS

-FilePath

Specifies the path to the file.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-TextToFind

Specifies the text to search for within the file.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Management.Automation.PSObject

NOTES

RELATED LINKS

Clone this wiki locally