-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
ggrep "os.execute" is equivalent to grep "os.execute" -r -n | sed 's/:\([0-9]\+\)/ -l \1/g' | sed 's/\([0-9]\+\):/\1 #/g' | sed 's/^\(\w\)/geany \1/g'
How the sed commands above work:
^\(w\)means capture the first word (^: next group must be preceeded by nothing) as a group, andgeany \1means place the "geany " command before that group in the output (and\1: place the first group in the output so it is kept)
(See https://stackoverflow.com/a/31976991/4541104 for the following)- regex operators (
(,),+,w) must be escaped to be used as operators (unless using "-r" but that is only available on GNU sed) otherwise they are treated as literals \1must always be escaped (even with -r) to denote that you want to place the first captured group back into the output[0-9]must be used because GNU sed does not recognize\dfor a number.\+is for one or more of the preceeding group (capture entire number in this case).
The piping or ggrep both translate the output from something like:
worldedit_commands/init.lua:137: os.execute ('mkdir "' .. path .. '"')
to
geany worldedit_commands/init.lua -l 137 # os.execute ('mkdir "' .. path .. '"')
and since . is wildcard, all things like os.execute, os_execute, and so on would be found.
Metadata
Metadata
Assignees
Labels
No labels