$ourfilesdata = Get-Content "P:\myfiles\details.txt"
foreach ($i in $ourfilesdata )
{
if ( $i -match '\Mobile\b') {continue)
{
Write-Output "$i"
}
}
**My input is like 50 lines **
aaaaaaa
bbbbb
Request
Mobile
Sim
datacard
internet
ccccccc
dddddddd
fffffff
Output
mobile
sim
datacard
internet
Note :- These input lines are horizontal fashion in my file
Select-String "P:\myfiles\details.txt" -Pattern 'Request\b' -Context 0,5 |
Foreach-Object { $_.Line,$_.Context.PostContext}
This will 100% works and thank me later :-)