asdff as df asdf a g a fas fa sdf as f asd f asdf a sdf a g gg a ds a s df asd g sh s gas f asdf asdf asd f 04/23/11 11:22:33 a;lsdf asdf sdfh 23
jga alkj d this is a test f 04/20/11 21:22:33 a;lsdf asdf sdfh 234 adsfa adslfkja sdflajd
应该如何写这个正则,作为FS的值呢?作者: ziyunfei 时间: 2011-04-27 20:47
--re-interval作者: sk1418 时间: 2011-04-27 21:00
谢谢学习了这个选项,以前还真不知道。 再问一下,我查看了man awk
里面关于这个选项:
--re-interval
Enable the use of interval expressions in regular expression matching (see Regular Expressions, below). Interval expressions were not traditionally
available in the AWK language. The POSIX standard added them, to make awk and egrep consistent with each other. However, their use is likely to break
old AWK programs, so gawk only provides them if they are requested with this option, or when --posix is specified.
意思就是gawk如果不用这个选项,FS就不按正则对待了。
可如果看FS部分:
Fields
As each input record is read, gawk splits the record into fields, using the value of the FS variable as the field separator. If FS is a single character,
fields are separated by that character. If FS is the null string, then each individual character becomes a separate field. Otherwise, FS is expected to be a
full regular expression.