sed /awk 字段截取,Help!
我有文件AT0010+1DAYSUNTIL0120+1DAYS
或者是:AT0010UNTIL0120+1DAYS
想把AT 和UNTIL 后的时间取出来:0010 0120
不知道有什么办法呀?
[解决办法]
。。上个帖子好像问过吧,awk,sed都有回答记得
grep呢?
grep -Po '\d{4}' | xargs -n2
[解决办法]
sed -r 's/[^0-9]*([0-9]{1,4})\+1DAYS[^0-9]*([0-9]{1,4})\+1DAYS/\1 \2/'
[解决办法]
echo "AT0010UNTIL0120+1DAYS" |sed 's/\+.*//g'| sed 's/[^0-9]*//g'
[解决办法]
5楼的对于AT0010+1DAYSUNTIL0120+1DAYS就不对了,用下面的
[u@H /billing/user/test]$echo "AT0010+1DAYSUNTIL0120+1DAYS"|sed "s/\+1DAYS//g"|sed "s/[^0-9]*//g"
00100120
[u@H /billing/user/test]$echo "AT0010UNTIL0120+1DAYS"|sed "s/\+1DAYS//g"|sed "s/[^0-9]*//g"
00100120