首页 > 解决方案 > 如何在 sed 上通过tipe grep 任何值

问题描述

我有一些价值观:

hybrisServer-Platform-1.1.2275-develop.zip
hybrisServer-Platform-1.1.2273-saphana-develop.zip
hybrisServer-Platform-1.1.2274-saphana-develop.zip
hybrisServer-Platform-1.1.2275-develop.zip
hybrisServer-Platform-1.1.2276-saphana-develop.zip
hybrisServer-Platform-1.1.2277-develop.zip
hybrisServer-Platform-1.1.2278-saphana-develop.zip

我如何才能grep仅使用(没有 saphana-develop)进行构建,例如:

hybrisServer-Platform-1.1.2277-develop.zip

此表达式仅写入文件 hybrisServer-Platform-1.1.2278-saphana-develop.zip

$ curl -s http://<ip address>:8081/artifactory/hybris-snapshot-local/| sed -rn "s/.*Platform-(.*\develop.*)\.zip.*/\1/p" | sort | grep develop | tail -1 | tr -d "\n" > /opt/test1.out

标签: curlsedgrep

解决方案


请更改 grep 表达式,因为grep -v saphana-develop | tail -1它只会打印最后修改过的没有 saphana-develop


推荐阅读