- 论坛徽章:
- 10
|
回复 1# xylcxyfc - px@ubuntu:~$ echo '"2000079086,001859"
- "2000079086""001859"
- "20000,79086""001859"' | awk 'BEGIN{FPAT = "([^,]+)|(\"[^\"]+\")"}{print "line "NR": "NF;print $1"@@"$2}'
- line 1: 1
- "2000079086,001859"@@
- line 2: 1
- "2000079086""001859"@@
- line 3: 1
- "20000,79086""001859"@@
复制代码 运行结果跟你不一样,- px@ubuntu:~$ awk --version
- GNU Awk 3.1.8
- Copyright (C) 1989, 1991-2010 Free Software Foundation.
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see http://www.gnu.org/licenses/.
复制代码 |
|