shell字符串处理

1.待实践

http://www.blogjava.net/Man/archive/2012/02/07/369504.html

http://blog.csdn.net/dao123mao/article/details/5339201

2.cut

echo "1/2/3/4" | cut -d"/" -f1   =》1

echo "1/2/3/4" | cut -d"/" -f1,3   =》1/3

echo "1/2/3/4/5/6/7" | cut -d"/" -f1-2,5-7   =》1/2/  +  5/6/7

3.

扫描二维码关注公众号,回复: 1303095 查看本文章

cut -c[rang1],[rang2]

cut -b[rang]

rang:

5   :第5个

5-  :第5个到最后一个

-5  :1-5

5-9 :5-9

猜你喜欢

转载自ama2000.iteye.com/blog/1431009