Getting Data In

sed combined help

mcbradford
Contributor

I am using the following to clean up output:

rex mode=sed field=search_google2 "s/\%20/ /g";"s/\%5B/[/g" | rex mode=sed field=search_google2 "s/\%22/\"/g" | rex mode=sed field=search_google2 "s/\%5B/[/g" | rex mode=sed field=search_google2 "s/\%5D/]/g" | rex mode=sed field=search_google2 "s/\%2B/+/g" | rex mode=sed field=search_google2 "s/\%2C/,/g" | rex mode=sed field=search_google2 "s/\%3A/:/g" | rex mode=sed field=search_google2 "s/\%27/'/g" | rex mode=sed field=search_google2 "s/\%40/@/g" | rex mode=sed field=search_google2 "s/\%3B/;/g" | rex mode=sed field=search_google2 "s/\%25/%/g"

I am new to regex.... can I combine the regex into one statement instead of the multiple pipes?

Tags (1)
0 Karma

kristian_kolb
Ultra Champion

Well, sed supports the y command (character substitution), but since there is not a 1-to-1 mapping, I don't think you can apply that here.

http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex
http://docs.splunk.com/Documentation/Splunk/5.0.2/Data/Anonymizedatausingconfigurationfiles#Through_...

However, you can put all of your regexes into props.conf SEDCMD statements, or through transforms, which would make the alteration permanent (may not be compatible with any requirements of keeping data in its original format, if you have such).

http://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf
http://docs.splunk.com/Documentation/Splunk/5.0.2/Data/Anonymizedatausingconfigurationfiles#Through_...

Hope this helps,

Kristian

Get Updates on the Splunk Community!

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...