我这里有这段代码
printf '$request1 = "select * from whatever where this = that and active = 1 order by something asc";\n'
| perl -pe 's/select/SELECT/gi ; s/from/\n FROM/gi ; s/where/\n WHERE/gi ; s/and/\n AND/gi ; s/order by/\n ORDER BY/gi ; s/asc/ASC/gi ; s/desc/DESC/gi ;'
| awk '{gsub(/\r/,"");printf "%s\n%d",$0,length($0)}'
它目前产生这样的输出
$request1 = "SELECT *
22 FROM whatever
17 WHERE this = that
24 AND active = 1
21 ORDER BY something ASC";
我想计算第一行(22)的数量并将该数量的空白添加到每一行。