I have an input as the following.
0:4:1 untagged 192.168.20.11 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
- 10 192.168.10.11 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
- 30 192.168.30.11 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
- 40 192.168.40.11 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
- 50 192.168.50.11 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
- 60 192.168.60.11 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
- 70 192.168.70.11 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
- 80 192.168.80.11 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
- 90 192.168.90.11 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
0:4:2 untagged 192.168.20.12 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
1:4:1 untagged 192.168.20.13 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
- 10 192.168.10.13 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
- 30 192.168.30.13 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
- 40 192.168.40.13 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
- 50 192.168.50.13 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
- 60 192.168.60.13 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
- 70 192.168.70.13 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
- 80 192.168.80.13 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
- 90 192.168.90.13 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
1:4:2 untagged 192.168.20.14 255.255.255.0 0.0.0.0 0 0.0.0.0 3205
I want to get the lines which starts with a dash but I want to swap the $1 of "untagged" lines with the dashes but I don't want the untagged lines in the output..
I tried lots of things with next but failed.
such as:
0:4:1 10
0:4:1 30
0:4:1 40
0:4:1 50
0:4:1 60
0:4:1 70
0:4:1 80
0:4:1 90
1:4:1 10
1:4:1 30
1:4:1 40
1:4:1 50
1:4:1 60
1:4:1 70
1:4:1 80
1:4:1 90
Appreciate your help, have struggled to solve this.. I thought about "getline" but there could be 2-9 lines which starts with dashes after untagged pattern seen..