Need tags from the images in aks

I have an images list like this

testcontainersgw.azurecr.io/reloader:v1.0.51
testcontainersgw.azurecr.io/tef/ip-id:19900909.1
testcontainersgw.azurecr.io/tef/ip-license:19900909.1
testcontainersgw.azurecr.io/tef/ip-finalsync:19900906.2
testcontainersgw.azurecr.io/tef/ip-tubelas:19900909.1
mcr.microsoft.com/aks/ip-masq-agent-v2:v0.1.11
mcr.microsoft.com/oss/kubernetes/kube-proxy:v1.30.3

and looking for an output with powershell command to only with the tags with specific name and discard remaining

ip-id
19900909.1
ip-license
19900906.2
ip-finalsync
19900906.2
ip-tubelas
19900909.1

Need output in same row

ip-id 19900909.1
ip-license 19900906.2
ip-finalsync 19900906.2
ip-tubelas 19900909.1

after the multiple values got list as below
Input

ip-id 19900909.1
ip-license 19900906.2
ip-finalsync 19900906.2
ip-tubelas 19900909.1
ip-id 19900809.1
ip-license 19900905.2
ip-finalsync 19900606.2
ip-tubelas 19900709.1
ip-id 19900509.1
ip-license 19900406.2
ip-finalsync 19900306.2
ip-tubelas 19900309.1

Expecting as below

ip-id = "19900909.1","19900809.1", "19900509.1"
ip-license = "19900906.2", "19900905.2", "19900406.2"
ip-finalsync = "19900306.2", "19900906.2", "19900606.2"
ip-tubelas =  ".,.,."

0

The .Remove method in PowerShell doesn’t work the way you’re attempting to use it, as it expects a single string, and you’re trying to use it on an array.

To filter out the specific tags and names and discard the numbers at the beginning of the strings, you can use a combination of -replace to remove the numbers and Select-String or Where-Object to filter specific names.

use this script

# The list of image tags from the previous command
$imageTags = @(
    "testcontainersgw.azurecr.io/reloader:v1.0.51",
    "testcontainersgw.azurecr.io/tef/ip-id:19900909.1",
    "testcontainersgw.azurecr.io/tef/ip-license:19900909.1",
    "testcontainersgw.azurecr.io/tef/ip-finalsync:19900906.2",
    "testcontainersgw.azurecr.io/tef/ip-tubelas:19900909.1",
    "mcr.microsoft.com/aks/ip-masq-agent-v2:v0.1.11",
    "mcr.microsoft.com/oss/kubernetes/kube-proxy:v1.30.3"
)

# Filter the image tags with "ip-" in the name and extract the tags
$filteredTags = $imageTags | Where-Object {
    # Filter lines containing "ip-"
    $_ -like "*ip-*"
} | ForEach-Object {
    # Extract the image name and version
    $nameVersion = $_ -split '[:/]'
    # Output the image name and version
    $nameVersion[2], $nameVersion[3]
}

# Output the filtered tags
$filteredTags


Example-

Deploy your images

Check the pods

Run the script I shared above

update for your follow up question-

To format the output of your PowerShell script so that the image name and version appear on the same line use the below script-

edited script-

# The list of image tags from the previous command
$imageTags = @(
    "testcontainersgw.azurecr.io/reloader:v1.0.51",
    "testcontainersgw.azurecr.io/tef/ip-id:19900909.1",
    "testcontainersgw.azurecr.io/tef/ip-license:19900909.1",
    "testcontainersgw.azurecr.io/tef/ip-finalsync:19900906.2",
    "testcontainersgw.azurecr.io/tef/ip-tubelas:19900909.1",
    "mcr.microsoft.com/aks/ip-masq-agent-v2:v0.1.11",
    "mcr.microsoft.com/oss/kubernetes/kube-proxy:v1.30.3"
)

# Filter the image tags with "ip-" in the name and extract the tags
$filteredTags = $imageTags | Where-Object {
    # Filter lines containing "ip-"
    $_ -like "*ip-*"
} | ForEach-Object {
    # Extract the image name and version
    $nameVersion = $_ -split '[:/]'
    # Output the image name and version in one line
    "$($nameVersion[2]) $($nameVersion[3])"
}

# Output the formatted tags
$filteredTags

output using the previous script vs output using this edited one.

4

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật