Archive

Remove spaces from all field names

Path Finder

Is there any quick way to remove specific at the beginning and end of all fields names? For example i am looking looking to remove all spaces to the left and right of all field names. How do i do this?

0 Karma

Observer

foreach * [ eval newFieldName=replace("<<FIELD>>", "\s+", "_"),  {newFieldName}='<<FIELD>>'  ] | fields - "* *", newFieldName

0 Karma

SplunkTrust
SplunkTrust

@aa70627, you are possibly looking for the trim() evaluation function. You can also use replace() evaluation function to replace regular expression based match pattern from string.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

SplunkTrust
SplunkTrust

Can you show an example of what you have right now, and how you would like it to be?

0 Karma