Simple data manipulation tool with a bang, inspired by qu.
pip3 install bombchu --user
- Ensure that where Python cli tools are installed on your system is in your PATH.
β― # break on a delimiter
β― echo "d,d,b,a,a,b,c,d,d,e" | bombchu -d ','
['d', 'd', 'b', 'a', 'a', 'b', 'c', 'd', 'd', 'e']
β― # same thing, but sort unique
β― echo "d,d,b,a,a,b,c,d,d,e" | bombchu -d ',' -s -u
['a', 'b', 'c', 'd', 'e']
β― # now output it separated by semi-colons
β― echo "d,d,b,a,a,b,c,d,d,e" | bombchu -d ',' -s -u -o '; '
a; b; c; d; e
β― # i got some csv data that looks like this...
β― head -n 2 foo.csv
start_time,ip,port
"2022-04-10 06:00:10",10.13.37.42,51111
β― # let's extract all the unique ips sorted and put them on new lines defanged
β― cat foo.csv | bombchu -c ip -u -n --defang --sips
10[.]13[.]37[.]42
10[.]22[.]22[.]11
10[.]44[.]44[.]22
β― # i gotta put this data in to splunk now in term format
β― cat foo.csv | bombchu -c ip -u --term
(TERM(10.22.22.11) OR TERM(10.13.37.42) OR TERM(10.44.44.22))
β― # now i got some json data that looks like this...
β― cat foo.json
{
"foo": {
"id": 1234
},
"foo2": {
"id": 1337
},
"foo3": {
"id": 1111
}
}
β― # i need all these ids sorted
β― cat foo.json | bombchu -j id -s
[1111, 1234, 1337]
β― # gimme those ids on new lines with back ticks
β― cat foo.json | bombchu -j id -s -n --add '`'
`1111`
`1234`
`1337`
β― # now i got some log file that looks like this...
β― head -n 2 foo.log
{"name": "joe", "id": 4242, "action": "bleh"}
{"name": "bob", "id": 1337, "action": "blah"}
β― # let's see the users in these logs
β― cat foo.log | bombchu -l name -o ', '
joe, bob, bob, bob, bob, john, john, bob, bob, susan, susan, bob
β― # now i need unique users and ids next to each other
β― cat foo.log | bombchu -l id,name -n -s -u
1337,bob
1337,john
1337,susan
4242,joe
β― # i need these sorted unique and ready to go into splunk
β― cat foo.log | bombchu -l name -s -u --splunk
("bob", "joe", "john", "susan")
β― # now throw that on my clipboard
β― cat foo.log | bombchu -l name -s -u --splunk --copy
("bob", "joe", "john", "susan")
β― # read in a python list
β― echo "['62', '41', '27', '111', '55']" | bombchu -p --addl '=' -n
=62
=41
=27
=111
=55