regex
esp0xdeadbeef opened this issue · comments
Hi,
thanks for the great tool, sadly I've got some problems with it.
Version: (i do not know how to get it while downloading it with go get ..)
md5sum /root/go/bin/cook
## output:
# 55e5ae65e1dafadb32960afb301f4349 /root/go/bin/cook
I do not understand the regular expression function. I'm trying to use the regex from here
Empty responses:
echo -e 'Job[49]\njob[49]\nJob[49]\njob[50]' | cook -d - d -m regex[^[a-z]+\[[0-9]+\]]
## outputs nothing
echo 'adam[23]\neve[7]\nJob[48]\nsnakey' | cook -d - -m regex[^[a-z]+\[[0-9]+\]] d
## output (should be adam[23] and eve[7] but is:
# adam[23]
The date function different in linux (maybe in future change it to square bracket instead of parenthesis)?
cook help usage | grep dob | cut -d '$' -f 2 | sh
## output:
# sh: 1: Syntax error: "(" unexpected
# i found the problem, should wildcard the brackets in linux:
cook help usage | grep dob | cut -d '$' -f 2 | sed -e 's/^[ \t]*//' | replace \( \\\( | replace \) \\\) | bash
elliot_17Sep1994
elliot_Sep171994
elliot_17/Sep/1994
elliot_Sep/17/1994
elliot_17-Sep-1994
elliot_Sep-17-1994
elliot_17.Sep.1994
elliot_Sep.17.1994
elliot_17.1994
elliot_Sep.1994
elliot_17.Sep
elliot-17Sep1994
elliot-Sep171994
elliot-17/Sep/1994
elliot-Sep/17/1994
elliot-17-Sep-1994
elliot-Sep-17-1994
elliot-17.Sep.1994
elliot-Sep.17.1994
elliot-17.1994
elliot-Sep.1994
elliot-17.Sep
regards,
esp0xdeadbeef.
usage for linux would be at this moment something like this:
cook help usage | cut -d '$' -f 2 | replace \( \\\( | replace \) \\\) | replace \` \\\`
## output:
# BASIC USAGE
# cook -start admin,root -sep _,- -end secret,critical / start sep end
# cook / admin,root _,- secret,critical
#
# FUNCTIONS
# Use functions such as date for different variations of values
# cook -dob date\(17,Sep,1994\) elliot _,- dob
#
# RANGES
# Use ranges like 1-100, A-Z, a-z or A-z in pattern of command
# cook 1-999
# cook a-z
# cook A-Z
# cook X-d
#
# RAW STRINGS
# Print value without any parsing/modification.
# cook -date \`date\(17,Sep,1994\)\` date
#
# PIPE INPUT
# Use - as param value for pipe input
# cook -d - d / test
#
# USING -min
# Print value without any parsing/modification
# cook n n n -min 1
Hi @esp0xdeadbeef,
Thanks for mentioning the issue.
Seems like there are a few issues while running cook in Linux.
I will start fixing them soon. Meanwhile, feel free to drop other bugs/issues you found.
Thanks
Gitesh
Hey @esp0xdeadbeef
I have fixed the functions, Now functions are using square brackets
For the regex, use this
[A-Za-z]+\[[0-9]+\]