J'ai un fichier appelé a.txt
qui contient,
time="2022-08-02T15:07:53+05:30" level=info msg="\x1b[32m\x1b[1mPUBLIC\x1b[39m\x1b[0m http://some.s3-ap-southeast-2.amazonaws.com/ (\x1b[33mhttp://some.com\x1b[39m)"
time="2022-08-02T15:07:53+05:30" level=info msg="\x1b[31m\x1b[1mFORBIDDEN\x1b[39m\x1b[0m http://some.s3.amazonaws.com (\x1b[33mhttp://some.com\x1b[39m)"
time="2022-08-02T15:07:54+05:30" level=info msg="\x1b[31m\x1b[1mFORBIDDEN\x1b[39m\x1b[0m http://some.s3.amazonaws.com (\x1b[33mhttp://some.com\x1b[39m)"
time="2022-08-02T15:07:58+05:30" level=info msg="\x1b[31m\x1b[1mFORBIDDEN\x1b[39m\x1b[0m http://some-assets.s3.amazonaws.com (\x1b[33mhttp://some.com\x1b[39m)"
time="2022-08-02T15:08:01+05:30" level=info msg="\x1b[31m\x1b[1mFORBIDDEN\x1b[39m\x1b[0m http://some.s3.amazonaws.com (\x1b[33mhttp://some.com\x1b[39m)"
Je veux cet output
PUBLIC http://some.s3-ap-southeast-2.amazonaws.com
FORBIDDEN http://some.s3.amazonaws.com
FORBIDDEN http://some.s3.amazonaws.com
FORBIDDEN http://some-assets.s3.amazonaws.com
FORBIDDEN http://some.s3.amazonaws.com
J'ai essayé ceci
cat a.txt | cut -d "=" -f4- | cut -d "[" -f3- | cut -d "m" -f2- | awk -F '\\.amazonaws.com' '{print $1".amazonaws.com"}'
Cela fonctionne, mais je n'arrive pas à supprimer \x1b[39m\x1b[0m