- 论坛徽章:
- 23
|
原帖由 无闻 于 2008-9-8 09:31 发表 ![]()
越看越有点云里雾里了,ly5066113能不能给出来一个可以完整执行的语句看看呀
man awk
r{n}
r{n,}
r{n,m} One or two numbers inside braces denote an interval expres-
sion. If there is one number in the braces, the preceding
regular expression r is repeated n times. If there are two
numbers separated by a comma, r is repeated n to m times.
If there is one number followed by a comma, then r is
repeated at least n times.
Interval expressions are only available if either --posix or
--re-interval is specified on the command line.
$ cat urfile
ccc aaa 2008-04-12 bbb fff 2008-04-18 fff
vvv aaa 2008-05-17 ccc fff 2008-09-17 fff
ggg ddd 2008-09-01 eee fff 2008-05-06 kkk
$ awk --posix '/[0-9]{4}-[0-9]{2}-[0-9]{2}/{$6="\047"$6"\047";print}' urfile
ccc aaa 2008-04-12 bbb fff '2008-04-18' fff
vvv aaa 2008-05-17 ccc fff '2008-09-17' fff
ggg ddd 2008-09-01 eee fff '2008-05-06' kkk |
|