相关代码 |
|
#!/usr/local/bin/gawk -f # # reverse-text -- # Reverse the word order in a text file # # $Header: /home/srilm/devel/utils/src/RCS/reverse-text.gawk,v 1.1 2003/01/01 18:35:23 stolcke Exp $ # BEGIN { start_tag = ""; end_tag = ""; } { if ($1 == start_tag) { i = 2; } else { i = 1; } if ($NF == end_tag) { j = NF - 1; } else { j = NF; } while (i < j) { h = $i; $i = $j; $j = h; i ++; j--; } print; }
相关资源 |
|