I'm trying to learn PowerShell.
On Bash, I analyze data with the "cut -c" command with multiple positions For example, if we have this input file:
Get-Process | tail > 1.txt # let's create an example file without headers...
To get the positions of each line from the 4'th to the 7'th characters and from the character range 57-72.
Get-Content .\1.txt | ForEach-Object { $_.substring(4,3)+ ' ' + $_.substring(57,15) }
That's a lot of typing... is there a better way?
An equivalent to the above in Bash is :
cut -c 4-7,57-72 1.log
A shorter way for your specific example in your comments could be something like this;
"abc def ghik"[1..2+10] -join ""