Powershell - Adding a line to a file from a specific line
To support me, you can subscribe to the channel, share and like the videos, disable your ad blocker or make a donation. Thank you!
Hello,
Having switched from a database-driven CMS site to a Markdown file-based site, I needed to modify what is known as the frontmatter.
A section at the beginning of the Markdown file containing information about the article (date, title, etc.).
The easiest way to do this is to use a collection (collection, arraylist, genericlist) that contains an .insert() method.
Here are a few examples of how to add a line to a specific location in a file (you know the line number where you want to place your text content)
Related links
Powershell - Display network connections (equivalent to netstat)
Display network connections (listening ports, active connections...)Powershell - Testing name resolution (equivalent to nslookup)
Powershell commands to test name resolution (equivalent to nslookup)Powershell - View and manage DNS configuration of network interfaces
Powershell commands to display and manage DNS configuration of network interfacesPowershell - Managing IP configuration of network interfaces
Powershell commands to view and modify the IP configuration of network interfacesPowershell - Managing the status and configuration of network interfaces
Powershell commands to view and modify the status and configuration of network interfaces (disable IPv6, enable/disable an interface)Powershell and the Left Hand Side
An important concept in Powershell, the Left Hand Side
Follow me on
Support me
Last content
Powershell - Display network connections (equivalent to netstat)
Powershell - Testing name resolution (equivalent to nslookup)
Powershell - View and manage DNS configuration of network interfaces
Powershell - Managing IP configuration of network interfaces
Powershell - Managing the status and configuration of network interfaces
Powershell and the Left Hand Side
Powershell - Managing disks, partitions and volumes
Powershell - Managing System Restore Points in Windows
Powershell - Playing with the Windows clipboard
Powershell - Changing the state of a computer (sleep, hibernate, shutdown, restart)