Linux Cut命令基本用法,grep INCREMENTAL_STEP /backup/3306/cycle_file | cut -d= -f2,-d后面就是分割符,砍甘蔗。
save_cycle_data || { echo 'save cycle data failed' && exit 1; } #调用函数失败的写法
basedir=$(cd "$(dirname "$0")";pwd)
echo $basedir
cat /backup/3306/cycle_file
BASE_ID=base-2018-06-11-1203
INCREMENTAL_STEP=20534973839
LAST_LSN=2
获取到等号后面的位置:
获取INNODB的Last checkpoint at:
参数之f3,砍断后第三节,如下:
$git branch -a|grep -v "*" | grep -v ">"
master
remotes/origin/dev
remotes/origin/master
Cut上来:
$git branch -a|grep -v "*" | grep -v ">"|cut -d "/" -f3
master
dev
master
sed 去空格和Tab:
git branch -a|grep -v "*" | grep -v ">"|cut -d "/" -f3|sed "s/^[ \t]*//g"
去掉重复行:
$git branch -a|grep -v "*" | grep -v ">"|cut -d "/" -f3|sed "s/^[ \t]*//g"
master
dev
master
按正顺序sort:(反着排序 -r)
$git branch -a|grep -v "*" | grep -v ">"|cut -d "/" -f3|sed "s/^[ \t]*//g"|sort
dev
master
master
uniq上来去重:
git branch -a|grep -v "*" | grep -v ">"|cut -d "/" -f3|sed "s/^[ \t]*//g"|sort|uniq
防止太多,限制10条,head -10上来:
git branch -a|grep -v "*" | grep -v ">"|cut -d "/" -f3|sed "s/^[ \t]*//g"|sort|uniq|head -10
当然,还有更简单的,不用git branch -a:
主要是了解命令:
$git branch |sed "s# ##g"|sed "s#*##"
dev
master
addr:You have new mail in /var/spool/mail/root
basedir=$(cd "$(dirname "$0")";pwd)
echo $basedir
cat /backup/3306/cycle_file
BASE_ID=base-2018-06-11-1203
INCREMENTAL_STEP=20534973839
LAST_LSN=2
获取到等号后面的位置:
获取INNODB的Last checkpoint at:
参数之f3,砍断后第三节,如下:
$git branch -a|grep -v "*" | grep -v ">"
master
remotes/origin/dev
remotes/origin/master
Cut上来:
$git branch -a|grep -v "*" | grep -v ">"|cut -d "/" -f3
master
dev
master
sed 去空格和Tab:
git branch -a|grep -v "*" | grep -v ">"|cut -d "/" -f3|sed "s/^[ \t]*//g"
去掉重复行:
$git branch -a|grep -v "*" | grep -v ">"|cut -d "/" -f3|sed "s/^[ \t]*//g"
master
dev
master
按正顺序sort:(反着排序 -r)
$git branch -a|grep -v "*" | grep -v ">"|cut -d "/" -f3|sed "s/^[ \t]*//g"|sort
dev
master
master
uniq上来去重:
git branch -a|grep -v "*" | grep -v ">"|cut -d "/" -f3|sed "s/^[ \t]*//g"|sort|uniq
防止太多,限制10条,head -10上来:
git branch -a|grep -v "*" | grep -v ">"|cut -d "/" -f3|sed "s/^[ \t]*//g"|sort|uniq|head -10
当然,还有更简单的,不用git branch -a:
主要是了解命令:
$git branch |sed "s# ##g"|sed "s#*##"
dev
master
addr:You have new mail in /var/spool/mail/root
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/9207/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2018-6-11 16:44
评论列表