I have some information stored in an external file.
On the main script I'm parsing the secondary file to work out how information should be processed.
To do so I have tried this:
cat ./secondary.file
file:block.txt @"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.)" | awk '{print $1"/"$3}'
which essentially defines where to get data and what to do to obtain the correct output. The idea being every line will have a new file:filename reference and a way to obtain a consistent output from each file.
So on the main file I can do this:
source=`cat ./secondary.file | grep -Ev "^#|^$" | tr -d "\r" | cut -d@ -f2`
which gives me "the method":
"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.)" | awk '{print $1"/"$3}'
I'm now trying to add this in a pipe of commands on the main script
... | grep -E $regex
which I was hoping would translate into something along the lines:
... | grep -E "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.)" | awk '{print $1"/"$3}'
but it fails complaining about grep not being a command and same for awk. I've tried to store full commands in the secondary-file like this
file:block.txt @grep -E "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.)" | awk '{print $1"/"$3}'
but and call it on the primary file like this:
source=`cat ./secondary.file | grep -Ev "^#|^$" | tr -d "\r" | cut -d@ -f2`
echo $source
grep -E "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.)" | awk '{print $1"/"$3}'
... | $source | ...
but again no luck. Running out of ideas...
0 Answers