我有以下字符串是從能分析一個網站,這將是一個bug修正分析尋找在bash shell中提取字符串
CERT_SUMMARY:127.0.0.1:127.0.0.1:631:sha256WithRSAEncryption:
/O=bfcentos7-test/CN=bfcentos7-test/emailAddress=root$bfcentos7-
test:/O=bfcentos7-test/CN=bfcentos7-test/emailAddress=root$bfcentos7-
test:170902005715Z:270831005715Z:self signed certificate
的一部分上的證書程序導出的最佳方式(考慮輸出以上是單行)
我需要的是在bash shell中提取sha256WithRSAEncryption
的最佳方法。這可能是像sha384withRSAEncryption
或其他東西。
在CERTSUMMARY
之後它將始終爲127.0.0.1:127.0.0.1:portnum
,高於其端口631
,但它可能是任何東西。
這在內部運行的系統上,並用SSL或TLS(未畫出)一起返回這個字符串
這是一個回報
CERT_SUMMARY:127.0.0.1:127.0.0.1:52311:sha256WithRSAEncryption:
/CN=ServerSigningCertificate_0/name=Type`Administrator
/name=DBName`ServerSigningCertificate_0:/C=US/CN=BLAHBLAH/
ST=California/L=Address, Emeryville CA 94608/O=IBM BigFix Evaluation
License/OU=Customer/[email protected]/name=
Hash`sha1/name=Server`bigfix01/name=CustomActions`Enable
/name=LicenseAllocation`999999/name=CustomRetrievedProperties`Enable:
170702212459Z:270630212459Z:unable to get local issuer certificate
提前感謝的另一個例子。 新手在shell編程,但學習!
你所說的「提取物」是什麼意思?你想知道'sha256WithRSAEncryption'或'sha384withRSAEncryption'是否在字符串中,或者你想提取該字符串後面的值?請澄清。 – Mecki
你還記得[這](https://stackoverflow.com/questions/46370872/extracting-just-the-open-port-numbers-from-netstat-output#comment79701789_46370872)發佈? – Cyrus
是..我想提取sha256WithRSAEncryption或任何值是在文本 – fossl