- 论坛徽章:
- 1
|
文本内容转换!
原帖由 "dolphinwwt" 发表:
'
1|06058680000001234560|0012345600|||||
2|06068680000001234562|0000566530|||||
#
也许是sed的版本的问题!
sed 's/\(^|[0-9]\{1,\}|\)0\{1,\}\([1-9][0-9]\{1,\}|\)/\1\2/g;s/.*/&||||/g' file|nl|tr -d '[]'
/home/lee#ksh f
1|012345678900|12345600|||||
2|012345678900|12345600|||||
3|012345678900|12345600|||||
4|012345678900|12345600|||||
5|6058680002220001234|1234500|||||
6|6058680001220001230|234520|||||
/home/lee#sed --version
GNU sed version 4.0.5
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
to the extent permitted by law. |
|