2013年1月28日

摘要: file="class.cpp"name=${file%.*}ext=${file#*.}echo "name=$name, ext=$ext"Output:name=class, ext=cppif file="/proj/class.cpp", name will be "/proj/class".% - means to delete the matched pattern from right to left, it is non-greedy, %% is greedy;# - means to dele 阅读全文
posted @ 2013-01-28 17:17 name2579 阅读(567) 评论(0) 推荐(0) 编辑
摘要: '\n' in the replace pattern in sed command doesn't work in Mac OS X.On Debian, we can get bellowing result:root# echo abc | sed 's/[^\n]/&\n/g'abcroot# But on Mac, it goes like this:user$ echo abc | sed 's/[^\n]/&\n/g'anbncnuser$Solution is to add \'$' bef 阅读全文
posted @ 2013-01-28 16:02 name2579 阅读(252) 评论(0) 推荐(0) 编辑

导航