Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute awk output

Tags:

bash

unix

awk

while read line;
do
  awk '/ differ$/ {print "diff "$2" "$4" > "$2".diff"}{}';
done < diffs.txt

This prints the command exactly as I want it. How do I tell it to execute the command?

like image 513
Michael Avatar asked Sep 20 '11 10:09

Michael


1 Answers

| bash does the trick...

while read line;
do
  awk '/ differ$/ {print "diff "$2" "$4" > "$2".diff"}{}' | bash;
done < diffs.txt
like image 64
Michael Avatar answered Sep 26 '22 08:09

Michael