|
|
Browse by Tags
All Tags » PowerShell » text
Showing page 1 of 2 (12 total posts)
-
I spotted a secred VBscript only spoiler here ? : How Can I Sort the Contents of a Text File in Numerical Order?
Guess why they tought a PoSH version was not needed ;-)
Get-Content test.txt | sort {[void]($_ -match '\d*');[int]$matches[0]}
For more text training see : Sesame PowerShell : Scripting Text Files
Or would they search more ...
-
Again a Hey Scripting Guy ! translation about replacements in Text files : How Can I Remove Duplicate Values From a Pair of Text Files?
To replace the 35 lines Vbscript solution with 3 loops given in the original article, the following PowerShell commands can be given interactivly on the console or used in a script ...
-
Some time ago but a new Hey Scripting Guy ! translation to PowerShell
How can I replace text that includes double quote marks and a tab character ?
the example given in this article is :
Speaking of which, let’s talk scripting for awhile. As we understand it, FC, you have a file (or maybe a bunch of files) that include this text, where ...
-
A question was asked in the PowerShell Newsgroup how to sort IP addresses with an AWK example for the same task given
Keith Hill made a blogpost about the same Newsgroup Post using .NET here : Sorting IP addresses the PowerShell way.
but I also liked that even using text parsing the resulting PoSH version ( after 20 NG posts ...
-
Another translation of an example script from a Hey scripting guy column How Can I Locate a Word in a Text File and Then Echo Back That Word and Any Remaining Text? from VbScript to PowerShell .
I made these 2 different versions within minutes : Get-Content test.txt | out-string |% ...
-
Ars technica did an article about PowerShell : Microsoft PowerShell rolled into Longhorn Server
In this article two PowerShell examples from my blog are used : How to get the uptime of a specific service: $s = gwmi win32_service -filter ''name = 'spooler''' ''{0}'' -f ((get-date) - ([wmi]'').ConvertToDateTime((gwmi ...
-
from the Hey Scripting Guy article :
How Can I Parse a Tab-Delimited File and Then Save That as a Comma-Separated Values File?
gc tab.txt |% {$_.split(''`t'') |? {$_ -match '='} |% {$r = new-object object} {$r | add-Member -memberType noteProperty -name $_.split('=')[0] -Value $_.split('=')[1]}{$r}} | export-csv -NoTypeInformation ...
-
And another VbScript to PowerShell translation of a scripting Guy Column, and (as expected ) again not to much problems with it this time ;-)
How Can I Count the Number of Characters in a Text File?
gc Text.txt | Measure-Object -Character
to do also line and Word count :
gc Text.txt | Measure-Object -Character -Word ...
-
And an other Hey Scripting guy ! translation to PowerShell How Can I Tally Up All the Words Found in a Text File?
Hey, Scripting Guy! While browsing the Internet I found a script that showed me how to get a list of all the unique words in a text file. That’s useful, but I’d like to go one step further: how can I determine the number ...
-
Event 6: Give Me a (75-Column) Break
PS Answer: Give Me a (75-Column) Break
My Answer was not the much different only using (gc alice.txt).split() |% { To loop the words directly ( '' '' is default for split )
Script looks like this :
$t = ''
$length = 0
(gc alice.txt).split() |% {
if ($length -eq 0) {
$t += ''$_''
...
1
|
|
|