store awk command in a variable of bash script
awk
Solution
Forget the backticks and parentheses. You just want to store the awk script itself
cmd='/something/ {if ...} {...} END {...}'
awk "$cmd" $input
Problem
I'm trying to store an awk command (command, not the result) in a variable. My objective is to use that variable later in the script, with different inputs. For example: ``` cmd=$(awk '/something/ {if ...} {...} END {...}') $cmd $input ``` I've tried to store the command with `$()` (like in the example), also with `backticks` ... But I'm not able to achieve it. I appreciate the help or any suggestion :)