Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Alphabetizing Anyone?
#9
For working in PowerShell:
I have formatted them as if you are running it from inside a SHELL call in QB64. The carets (^) are needed to escape the pipe (|) characters. If you are running it already in PowerShell, you would get rid of "PowerShell -NoProfile" and the carets.

If you want the directory listing of all text files sorted (PowerShell):
Quote:PowerShell -NoProfile Get-ChildItem -Filter *.txt ^| Select Name -ExpandProperty Name ^| Sort-Object > sorted.txt

If you already have a file with content inside of it (PowerShell):
Quote:PowerShell -NoProfile Get-Content -Path examplefile.txt ^| Sort-Object > sorted.txt

P.S
The "-NoProfile" switch is necessary for PowerShell because there are profile scripts that are loaded when it is started that slow down execution considerably. "-NoProfile" tells it to ignore user settings which speeds up the call.

P.P.S
The redirect to sorted.txt is only necessary if you are not using pipecom. Without pipecom, you won't have access to the direct stdout handle. With it, you would remove that redirect and just grab the raw stdout from the call.
Tread on those who tread on you

Reply


Messages In This Thread
Alphabetizing Anyone? - by NakedApe - 12-20-2023, 05:42 PM
RE: Alphabetizing Anyone? - by SMcNeill - 12-20-2023, 06:17 PM
RE: Alphabetizing Anyone? - by NakedApe - 12-20-2023, 08:20 PM
RE: Alphabetizing Anyone? - by bplus - 12-20-2023, 09:53 PM
RE: Alphabetizing Anyone? - by NakedApe - 12-21-2023, 05:27 PM
RE: Alphabetizing Anyone? - by mnrvovrfc - 12-21-2023, 05:32 PM
RE: Alphabetizing Anyone? - by bplus - 12-21-2023, 09:42 PM
RE: Alphabetizing Anyone? - by SMcNeill - 02-25-2024, 03:24 AM
RE: Alphabetizing Anyone? - by SpriggsySpriggs - 12-21-2023, 06:02 PM
RE: Alphabetizing Anyone? - by TerryRitchie - 12-21-2023, 06:08 PM
RE: Alphabetizing Anyone? - by SpriggsySpriggs - 12-21-2023, 07:46 PM
RE: Alphabetizing Anyone? - by NakedApe - 12-21-2023, 08:06 PM



Users browsing this thread: 1 Guest(s)