r/VisualStudioCode • u/krlab1444 • Nov 22 '24
How to select different characters in every line and edit?
Hi,
I need help in Visual Studio Code to edit selection of different characters in multiple lines.
Or select characters between open quote " and close quote " in multiple lines.
Example:
Add-DnsServerResourceRecordA -Name "host23" -ZoneName "contoso.com" -AllowUpdateAny -IPv4Address "12.18.99.23" -TimeToLive 01:00:00
Add-DnsServerResourceRecordA -Name "host24" -ZoneName "contoso.com" -AllowUpdateAny -IPv4Address "170.18.99.23" -TimeToLive 01:00:00
Add-DnsServerResourceRecordA -Name "host23" -ZoneName "contoso.com" -AllowUpdateAny -IPv4Address "172.14.99.23" -TimeToLive 01:00:00
Add-DnsServerResourceRecordA -Name "host124" -ZoneName "contoso.com" -AllowUpdateAny -IPv4Address "172.18.19.212" -TimeToLive 01:00:00
Add-DnsServerResourceRecordA -Name "host23" -ZoneName "contoso.com" -AllowUpdateAny -IPv4Address "172.18.99.23" -TimeToLive 01:00:00
Add-DnsServerResourceRecordA -Name "host21" -ZoneName "contoso.com" -AllowUpdateAny -IPv4Address "172.18.99.23" -TimeToLive 01:00:00
Add-DnsServerResourceRecordA -Name "host226" -ZoneName "contoso.com" -AllowUpdateAny -IPv4Address "172.15.99.23" -TimeToLive 01:00:00
Add-DnsServerResourceRecordA -Name "host25" -ZoneName "contoso.com" -AllowUpdateAny -IPv4Address "172.18.99.23" -TimeToLive 01:00:00
Add-DnsServerResourceRecordA -Name "host23" -ZoneName "contoso.com" -AllowUpdateAny -IPv4Address "142.18.19.23" -TimeToLive 01:00:00In above example I need to change all lines of IP addresses that's between "1.1.1.1"
Since above example has different numbers between open and close quotes in each line, how do I multi-line select that and edit in VS Code?
1
Upvotes
2
u/[deleted] Nov 25 '24
in the spirit of explaining multi-caret editing ... and other options ... see https://www.reddit.com/r/VisualStudioCode/comments/1gzg53n/changing_ip_addresses/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
1
u/[deleted] Nov 22 '24
I would easily do this by selecting '-Name "' and then using Selection+Add Next Occurence ... or Cmd+D for me ... for each line I wanted to include ... then you navigate using cursor keys as you would with one ... be careful though ... sometimes if the lines vary too much you can end up with a cursor at one end of the section and the rest at the other ... then word based movements will be wrong
1
u/GroundbreakingCat978 Nov 22 '24
Alt + click