Hey all,
I hope someone can help me to fix my problem with powershell. I am completely new to that field.
Here ist the problem: I have several txt.files of which I wanted to copy the 13th line of each into one single file. At the moment I am doing this manually but it takes a lot of time doing that.
I attached an image of the specific line of my txt.file I want to copy (its marked in purple and I hope its the 13th line :D)
Currently I work on a mac and I use this code:
-
cd “here I insert the path to the folder with the txt files”
→ I press enter and insert the next code:
- Get-ChildItem -path “here I insert the path to the folder with the txt files" | ForEach-Object {(Get-content *.txt -TotalCount 13)[-1]>>out.txt}
If I start directly with the Get-ChildItem code my mac cannot find the path.
This code works and creates an out.txt file with e.g 5 lines from 5 files. However, these 5 lines show the same values and I cannot even find these values in the original txt.file.
If someone could help me with this issue I would be very thankful.
All the best,
Anne
