为什么要学习 Shell ? 1)需要看懂运维人员编写的 Shell 程序 2)偶尔会编写一些简单 Shell 程序来管理集群、提高开发效率 Shell 概述 Shell 是一个命令行解释器,它接收应用程序/用户命令,然后调用操作系统内核 Shell 还是一个功能相当强大的编程语言,易编写、易调试、灵活性强
1)Linux 提供的 Shell 解析器有
[root@CentOS64 ~]# cat /etc/shells /bin/sh /bin/bash /sbin/nologin /bin/dash /bin/tcsh /bin/csh2)bash 和 sh 的关系
[root@CentOS64 bin]# ll | grep bash -rwxr-xr-x. 1 root root 941880 5月 11 2016 bash lrwxrwxrwx. 1 root root 4 7月 2 00:44 sh -> bash3)CentOS 默认的解析器是 bash
[root@CentOS64 bin]# echo $SHELL /bin/bash脚本以 #!/bin/bash 开头【指定解析器】
1)需求:创建一个 Shell 脚本,输出 helloworld 2)案例实操
[root@CentOS64 datas]# touch helloworld.sh [root@CentOS64 datas]# vi helloworld.sh在 helloworld.sh 中输入如下内容
#!/bin/bash echo "helloworld"3)脚本的常用执行方式 第一种:采用 bash 或 sh+脚本的相对路径或绝对路径(不用赋予脚本+x权限) sh+脚本的相对路径
[root@CentOS64 datas]# sh helloworld.sh helloworldsh+脚本的绝对路径
[root@CentOS64 datas]# sh /datas/helloworld.sh helloworldbash+脚本的相对路径
[root@CentOS64 datas]# bash helloworld.sh helloworldbash+脚本的绝对路径
[root@CentOS64 datas]# bash /datas/helloworld.sh helloworld第二种:采用输入脚本的绝对路径或相对路径执行脚本(必须具有可执行权限+x) a)首先要赋予 helloworld.sh 脚本的+x 权限
[root@CentOS64 datas]# chmod 777 helloworld.shb)执行脚本 相对路径
[root@CentOS64 datas]# ./helloworld.sh helloworld绝对路径
[root@CentOS64 datas]# /datas/helloworld.sh helloworld注意:第一种执行方法,本质是 bash 解析器帮你执行脚本,所以脚本本身不需要执行权限,第二种执行方法,本质是脚本需要自己执行,所以需要执行权限
1)需求 在 /datas/ 目录下创建一个 hello.txt,在 hello.txt 中增加” i love d“ 2)案例实操
[root@CentOS64 datas]# touch batch.sh [root@CentOS64 datas]# vi batch.sh [root@CentOS64 datas]# sh batch.sh [root@CentOS64 datas]# ls batch.sh hello.txt helloworld.sh [root@CentOS64 datas]# cat hello.txt i love dbatch.sh 中输入内容
#!/bin/bash cd /datas touch hello.txt echo "i love d">>hello.txt1. 常用系统变量 H O M E 、 HOME、 HOME、PWD、 S H E L L 、 SHELL、 SHELL、USER 等 2. 案例实操 1)查看系统变量的值
[root@CentOS64 datas]# echo $HOME /root2)显示当前 Shell 中所有变量:set
[root@CentOS64 datas]# set BASH=/bin/bash BASHOPTS=checkwinsize:cmdhist:expand_aliases:extquote:force_fignore:hostcomplete:interactive_comments:login_shell:progcomp:promptvars:sourcepath BASH_ALIASES=() BASH_ARGC=() BASH_ARGV=() BASH_CMDS=() BASH_LINENO=() BASH_SOURCE=() BASH_VERSINFO=([0]="4" [1]="1" [2]="2" [3]="1" [4]="release" [5]="x86_64-redhat-linux-gnu") BASH_VERSION='4.1.2(1)-release' COLORS=/etc/DIR_COLORS COLUMNS=114 ......1. 基本语法 1)定义变量:变量=值 2)撤销变量:unset变量 3)声明静态变量:readonly 变量,注意不能 unset 2. 变量定义规则 1)变量名称可以由字母、数字和下划线组成,但是不能以数字开头,环境变量名建议大写 2)等号两侧不能有空格 3)在 bash 中,变量默认类型都是字符串类型,无法直接进行数值运算 4)变量的值如果有空格,需要使用双引号或单引号括起来 3. 案例实操 1)定义变量A
[root@CentOS64 ~]# A=5 [root@CentOS64 ~]# echo $A 52)给变量A重新赋值
[root@CentOS64 ~]# A=8 [root@CentOS64 ~]# echo $A 83)撤销变量A
[root@CentOS64 ~]# unset A [root@CentOS64 ~]# echo $A [root@CentOS64 ~]#4)声明静态的变量B=2,不能 unset
[root@CentOS64 ~]# readonly B=2 [root@CentOS64 ~]# echo $B 2 [root@CentOS64 ~]# B=9 -bash: B: readonly variable5)在 bash 中,变量默认类型都是字符串类型,无法直接进行数值运算
[root@CentOS64 ~]# C=1+2 [root@CentOS64 ~]# echo $C 1+26)变量的值如果有空格,需要使用双引号或单引号括起来
[root@CentOS64 ~]# D=I love D -bash: love: command not found [root@CentOS64 ~]# D="I love D" [root@CentOS64 ~]# echo $D I love D7)可以把变量提升为全局环境变量,可供其他 Shell 程序使用 export 变量名
[root@CentOS64 datas]# vim helloworld.sh //将 echo $B 增加到文件 helloworld.sh 中 [root@CentOS64 datas]# ./helloworld.sh helloworld [root@CentOS64 datas]# export B //将 B 提升为全局变量 [root@CentOS64 datas]# ./helloworld.sh helloworld 21. 基本语法
$n【n 为数字,$0 代表该脚本名称,$1-$9代表第一到第九个参数,十以上参数需要用大括号包含,如${10}】2. 案例实操 1)输出该脚本文件名称、输入参数1和输入参数2的值
[root@CentOS64 datas]# touch parameter.sh [root@CentOS64 datas]# vim parameter.sh [root@CentOS64 datas]# chmod 777 parameter.sh [root@CentOS64 datas]# ./parameter.sh l d ./parameter.sh l d #!/bin/bash echo "$0 $1 $2"1. 基本语法
$#【获取所有输入参数个数,常用于循环】2. 案例实操
[root@CentOS64 datas]# vim parameter.sh //将 echo $# 输入到文件中去 [root@CentOS64 datas]# chmod 777 parameter.sh [root@CentOS64 datas]# ./parameter.sh l d ./parameter.sh l d 21. 基本语法
$*【这个变量代表命令行中所有的参数,它把所有的参数看成一个整体】 $@【这个变量也代表命令行中所有的参数,不过它把每个参数区分对待】2. 案例实操 1)打印输入的所有参数
[root@CentOS64 datas]# vim parameter.sh //添加 $* 和 $@ [root@CentOS64 datas]# bash parameter.sh 1 2 3 parameter.sh 1 2 //echo "$0 $1 $2" 3 //echo $# 1 2 3 //echo $* 1 2 3 //echo $@1. 基本语法
$?【最后一次执行的命令的返回状态,如果这个变量的值为0,证明上一个命令正确执行,如果这个变量的值为非0(具体哪个数,由命令自己决定),则证明上一个命令执行不正确】2. 案例实操 1)判断 helloworld.sh 脚本是否正确执行
[root@CentOS64 datas]# ./helloworld.sh helloworld 2 [root@CentOS64 datas]# echo $? 01. 基本语法
1)"$((运算式))"或"$[运算式]" 2)expr + , - , \* , / ,% 加减乘除取余 注意:expr运算符中间要有空格2. 案例实操 1)计算 3+2 的值
[root@CentOS64 datas]# expr 2+3 2+3 [root@CentOS64 datas]# expr 2 + 3 52)计算 3-2 的值
[root@CentOS64 datas]# expr 3 - 2 13)计算 (2+3)x4的值 a)expr 一步完成计算
[root@CentOS64 datas]# expr `expr 2 + 3` \* 4 20b)采用 $[运算式]方式
[root@CentOS64 datas]# S=$[(2+3)*4] [root@CentOS64 datas]# echo $S 201. 基本语法
[ condition ]【 condition 前后要有空格】 条件非空即为true,[ root ]返回 true,[] 返回 false2. 常用判断条件
1)两个整数之间比较 = 【字符串比较】 -lt 【小于 less than】 -le 【小于等于 less equal】 -eq 【等于 equal】 -gt 【大于 greater than】 -ge 【大于等于 greater equal】 -ne 【不等于 not equal】 2)按照文件权限进行判断 -r 【有读的权限 read】 -w 【有写的权限 write】 -x 【有执行的权限 execute】 3)按照文件类型进行判断 -f 【文件存在并且是一个常规文件 file】 -e 【文件存在 existence】 -d 【文件存在并且是一个目录】3. 案例实操 1)23是否大于22
[root@CentOS64 datas]# [ 23 -ge 22 ] [root@CentOS64 datas]# echo $? 02)helloworld.sh 是否具有写权限
[root@CentOS64 datas]# [ -w helloworld.sh ] [root@CentOS64 datas]# echo $? 03)/home/jack/d.txt 目录中的文件是否存在
[root@CentOS64 datas]# [ -e /home/jack/d.txt ] [root@CentOS64 datas]# echo $? 14)多条件判断【&&表示前一条命令执行成功时,才执行后一条命令,||表示上一条命令执行失败后,才执行下一条命令】
[root@CentOS64 datas]# [ condition ]&& echo OK || echo notOK OK [root@CentOS64 datas]# [ condition ]&&[ ] || echo notOK notOK1. 基本语法
if [ 条件判断式 ];then 程序 fi 或者 if [ 条件判断式 ] then 程序 fi注意事项 1)[ 条件判断式 ]中括号和条件判断式之间必须有空格 2)if 后要有空格 2. 案例实操 1)输入一个数字,如果是1,则输出 i love d ,如果是2 ,则输出 d love i,如果是其他,什么也不输出
[root@CentOS64 datas]# touch if.sh [root@CentOS64 datas]# vim if.sh [root@CentOS64 datas]# chmod 777 if.sh [root@CentOS64 datas]# ./if.sh 1 i love d #!/bin/bash if [ $1 -eq "1" ] then echo "i love d" elif [ $1 -eq "2" ] then echo "d love i" fi1. 基本语法
case $变量名 in "值1") 如果变量的值等于值1,则执行程序1 ;; "值2") 如果变量的值等于值2,则执行程序2 ;; ...... *) 如果变量的值都不是以上的值,则执行此程序 ;; esac注意事项 1)case 行尾必须为单词 in ,每个模式匹配必须以后括号“)”结束 2)双分号“;;”表示命令序列结束,相当于 java 中的 break 3)最后的“*)”表示默认模式,相当于java终端额default 2. 案例实操 1)输入一个数字,如果是1,则输出 jack,如果是2,则输出 tom,如果是其他,输出,jerry
[root@CentOS64 datas]# touch case.sh [root@CentOS64 datas]# vim case.sh [root@CentOS64 datas]# cat case.sh #!/bin/bash case $1 in "1") echo "jack" ;; "2") echo "tom" ;; *) echo "jerry" ;; esac [root@CentOS64 datas]# chmod 777 case.sh [root@CentOS64 datas]# ./case.sh 1 jack1. 基本语法1
for ((初始值;循环控制条件;变量变化)) do 程序 done2. 案例实操 1)从1加到100
[root@CentOS64 datas]# touch for1.sh [root@CentOS64 datas]# vim for1.sh [root@CentOS64 datas]# cat for1.sh #!/bin/bash s=0 for((i=0;i<=100;i++)) do s=$[$s+$i] done echo $s [root@CentOS64 datas]# chmod 777 for1.sh [root@CentOS64 datas]# ./for1.sh 50503. 基本语法2
for 变量 in 值1 值2 值3... do 程序 done4. 案例实操 1)打印所有输入参数
[root@CentOS64 datas]# touch for2.sh [root@CentOS64 datas]# vim for2.sh [root@CentOS64 datas]# cat for2.sh #!/bin/bash #打印数字 for i in $* do echo "i love d $i" done [root@CentOS64 datas]# chmod 777 for2.sh [root@CentOS64 datas]# bash for2.sh d z h i love d d i love d z i love d h2)比较 $* 和 $@ 的区别 a)$* 和 $@ 都表示传第给函数或脚本的所有参数,不被双引号“”包含时,都以 $1…$2…$3…$n的形式输出所有参数
[root@CentOS64 datas]# touch for.sh [root@CentOS64 datas]# vim for.sh [root@CentOS64 datas]# cat for.sh #!/bin/bash for i in $* do echo "i love d $i" done for j in $@ do echo "i love d $j" done [root@CentOS64 datas]# bash for.sh d z h i love d d i love d z i love d h i love d d i love d z i love d hb)当它们被双引号“”包含时,$*会将所有的参数作为一个整体,以”$1 $2 …$n”的形式输出所有参数;$@会将各个参数分开,以$1$2...$n的形式输出所有参数
[root@CentOS64 datas]# vim for.sh [root@CentOS64 datas]# cat for.sh #!/bin/bash for i in "$*" do echo "i love d $i" done for j in "$@" do echo "i love d $j" done [root@CentOS64 datas]# bash for.sh d z h i love d d z h i love d d i love d z i love d h1. 基本语法
while [ 条件判断式 ] do 程序 done2. 案例实操 1)从1加到100
[root@CentOS64 datas]# touch while.sh [root@CentOS64 datas]# vim while.sh [root@CentOS64 datas]# cat while.sh #!/bin/bash s=0 i=1 while [ $i -le 100 ] do s=$[$s+$i] i=$[$i+1] done echo $s [root@CentOS64 datas]# chmod 777 while.sh [root@CentOS64 datas]# ./while.sh 50501. 基本语法
read 选项 参数选项 -p【指定读取值时的提示符】 -t【指定读取值时等待的时间(秒)】 参数 变量【指定读取值的变量名】 2. 案例实操 1)提示7秒内,读取控制台输入的名称
[root@CentOS64 datas]# touch read.sh [root@CentOS64 datas]# vim read.sh [root@CentOS64 datas]# cat read.sh read -t 7 -p "Enter your name in 7 seconds" NAME echo $NAME [root@CentOS64 datas]# chmod 777 read.sh [root@CentOS64 datas]# ./read.sh Enter your name in 7 seconds liu liu1. basename 基本语法 basename [string / pathname] [suffix]【basename命令会删掉所有的前缀包裹最后一个”/“字符,然后将字符串显示出来】 选项 suffix 为后缀,如果 suffix 被指定了,basename 会将 pathname 或 string 中的 suffix 去掉 2. 案例实操 1)截取 /datas/hello.txt 路径的文件名称
[root@CentOS64 datas]# basename /datas/hello.txt hello.txt hello.txt [root@CentOS64 datas]# basename /datas/hello.txt .txt hello3. dirname 基本语法 dirname 文件绝对路径【从给定的包含绝对路径的文件名中去除文件名(非目录部分),然后返回剩下的路径(目录的部分)】 4. 案例实操 1)获取 hello.txt 文件的路径
[root@CentOS64 datas]# dirname /datas/hello.txt /datas1. 基本语法
[ function ] funname[0] { Action; [return int;] } funname2. 经验技巧 1)必须在调用函数地方之前,先声明函数,Shell 脚本是逐行运行,不会像其它语言一样先编译 2)函数返回值,只能通过 $? 系统变量获得,可以显示加:return 返回,如果不加,将以最后一条命令运行结果,作为返回值,return 后跟数值 n(0-255) 3. 案例实操 1)计算两个输入参数的和
[root@CentOS64 datas]# touch fun.sh [root@CentOS64 datas]# vim fun.sh [root@CentOS64 datas]# cat fun.sh #!/bin/bash function sum() { s=0 s=$[ $1 + $2 ] echo "$s" } read -p "please input the number1: " n1; read -p "please input the number2: " n2; sum $n1 $n2; [root@CentOS64 datas]# chmod 777 fun.sh [root@CentOS64 datas]# ./fun.sh please input the number1: 13 please input the number2: 24 37cut 的工作就是”剪“,具体地说就是在文件中负责剪切数据用的,cut 命令从文件的每一行剪切字节、字符和字段并将这些字节、字符和字段输出 1. 基本用法
cut 选项参数 filename说明:默认分隔符是制表符 2. 选项参数说明 -f【列号,提取第几列】 -d【分隔符,按照指定分隔符分割列】 3. 案例实操 1)数据准备
[root@CentOS64 datas]# touch cut.txt [root@CentOS64 datas]# vim cut.txt [root@CentOS64 datas]# cat cut.txt bei jing tian shan jin xi xi shan nan jing jin nan2)切割 cut.txt 第一列
[root@CentOS64 datas]# cut -d " " -f 1 cut.txt bei tian jin xi nan jin3)切割 cut.txt 第二、三列
[root@CentOS64 datas]# cut -d " " -f 2,3 cut.txt jing shan xi shan jing nan4)在 cut.txt 文件中切割出 jing
[root@CentOS64 datas]# cat cut.txt | grep "jing" | cut -d " " -f 2 jing jing5)选取系统 PATH 变量值,第二个”:“开始后的所有路径
[root@CentOS64 datas]# echo $PATH /usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin [root@CentOS64 datas]# echo $PATH | cut -d ":" -f 2- /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin6)切割 ifconfig 后打印 IP 地址
[root@CentOS64 datas]# ifconfig eth0 | grep "inet addr" | cut -d: -f 2 |cut -d " " -f 1 192.168.1.64sed 是一种流编辑器,它一次处理一行内容,处理时,把当前处理的行存储在临时缓冲区中,称为"模式空间”,接着用 sed 命令处理缓冲区中的内容,处理完成后,把缓冲区的内容送往屏幕,接着处理下一行,这样不断的重复,直到文件末尾,文件内容并没有改变,除非你使用重定向存储输出 1. 基本用法
sed 选项参数 'command' filename2. 选项参数说明 -e【直接在指令列模式上进行 sed 的动作编辑】 3. 命令功能描述 a【新增,a 的后面可以接字符串,在下一行出现】 d【删除】 s【查找并替换】 4. 案例实操 1)数据准备
[root@CentOS64 datas]# touch sed.txt [root@CentOS64 datas]# vim sed.txt [root@CentOS64 datas]# cat sed.txt bei jing nan jing tian jin shan xi xi shan jin nan2)将 “shang hai” 这个单词插入到 sed.txt 第二行下,打印 【文件并没有发生改变】
[root@CentOS64 datas]# sed '2a shang hai' sed.txt bei jing nan jing shang hai //实际文件中并未增加 tian jin shan xi xi shan jin nan [root@CentOS64 datas]# cat sed.txt bei jing nan jing tian jin shan xi xi shan jin nan3)删除 sed.txt 文件所有包含 jin 的行
[root@CentOS64 datas]# sed '/jin/d' sed.txt shan xi xi shan [root@CentOS64 datas]# cat sed.txt bei jing nan jing tian jin shan xi xi shan jin nan4)将 sed.txt 文件中 xi 替换为 dong
[root@CentOS64 datas]# sed 's/xi/dong/g' sed.txt bei jing nan jing tian jin shan dong dong shan jin nang 表示 global,全部替换 5)将 sed.txt 文件中的第二行删除并将 nan 替换为 bei
[root@CentOS64 datas]# sed -e '2d' -e 's/nan/bei/g' sed.txt bei jing tian jin shan xi xi shan jin bei一个强大的文本分析工具,把文件逐行的读入,以空格为默认分隔符将每行切片,切开的部分再进行分析处理 1. 基本用法
awk 选项参数 'pattern1{action1} pattern2{action2}...' filename pattern【表示 AWK 在数据中查找的内容,就是匹配模式】 action【在找到匹配内容时所执行的一系列命令】2. 选项参数说明 -F【指定输入文件折分隔符】 -v【复制一个用户定义变量】 3. 案例实操 1)数据准备
[root@CentOS64 datas]# sudo cp /etc/passwd ./2)搜索 passwd 文件以 root 关键字开头的所有行,并输出该行的第七列
[root@CentOS64 datas]# awk -F: '/^root/{print $7}' passwd /bin/bash3)搜索 passwd 文件以 root 关键字开头的所有行,并输出改行的第一列和第七列,中间以“,”号分割 注意:只有匹配了 pattern 的行才会执行 action
[root@CentOS64 datas]# awk -F: '/^root/{print $1","$7} passwd root./bin/bash4)只显示 /etc/passwd 的第一列和第七列,以逗号分割,且在所有行前面添加列名 user, Shell 在最后一行添加"pop,/bin/yuedeer" 注意:BEGIN 在所有数据读取行之前执行;END 在所有数据执行之后执行
[root@CentOS64 datas]# awk -F: 'BEIN{print "user,shell"}{print $1","$7} END{print "pop,/bin/yuedeer"}' passwd user,shell root,/bin/bash bin,/sbin/nologin daemon,/sbin/nologin adm,/sbin/nologin ...... pop,/bin/yuedeer5)将 passwd 文件中的用户 id 增加数值 1 并输出
[root@CentOS64 datas]# awk -v i=1 -F: '{print $3+i}' passwd 1 2 3 4 5 64. awk 的内置变量 FILENAME【文件名】 NR【已读的记录数】 NF【浏览记录的域的个数(切割后,列的个数)】 5 案例实操 1)统计 passwd 文件名,每行的号,每行的列数
[root@CentOS64 datas]# awk -F: '{print"filename:" FILENAME ",linenumber:" NR ",columns:" NF}' passwd filename:passwd,linenumber:1,columns:7 filename:passwd,linenumber:2,columns:7 filename:passwd,linenumber:3,columns:7 filename:passwd,linenumber:4,columns:7 filename:passwd,linenumber:5,columns:7 filename:passwd,linenumber:6,columns:7 filename:passwd,linenumber:7,columns:7 filename:passwd,linenumber:8,columns:7 filename:passwd,linenumber:9,columns:7 filename:passwd,linenumber:10,columns:7 ......2)切割 IP
[root@CentOS64 datas]# ifconfig eth0 | grep "inet addr" | awk -F: '{print $2}' | awk -F " " '{print $1}' 192.168.1.643)查询 sed.txt 中空行所在的行号
[root@CentOS64 datas]# awk '/^$/{print NR}' sed.txt 6 7sort 命令在 Linux 里非常有用,它将文件进行排序,并将排序的结果标准输出 1. 基本语法 sort 选项 参数 -n【依照数值的大小排序】 -r【以相反的顺序来排序】 -t【设置排序时所用的分隔字符】 -k【指定需要排序的列】 参数【指定待排序的文件列表】 2 案例实操 1)数据准备
[root@CentOS64 datas]# touch sort.sh [root@CentOS64 datas]# vim sort.sh [root@CentOS64 datas]# cat sort.sh aa:90:8.2 bb:80:7.3 cc:70:5.6 dd:110:9.5 ee:200:6.8 ff:10:1.62)按照”:“分割后的第三列倒序排序
[root@CentOS64 datas]# sort -t: -nrk 3 sort.sh dd:110:9.5 aa:90:8.2 bb:80:7.3 ee:200:6.8 cc:70:5.6 ff:10:1.61)使用 Linux 命令查询 file1 中空行所在的行号 【awk ‘/^$/{print NR}’ sed.txt】 2)有文件 chengji.txt 内容如下 张三 40 李四 50 王五 60 使用 Linux 命令计算第二列的和并输出 【cat chengji.txt | awk -F " " ‘{sum+=$2} END{print sum}’
[root@CentOS64 datas]# touch chengji.txt [root@CentOS64 datas]# vim chengji.txt [root@CentOS64 datas]# cat chengji.txt 张三 40 李四 50 王五 60 [root@CentOS64 datas]# cat chengji.txt | awk -F " " '{sum+=$2}END{print sum}' 1501)Shell 脚本里如何检查一个文件是否存在?如果不存在该如何处理?
#!/bin/bash if [ -f file.txt ];then echo "文件存在" else echo "文件不存在" fi1)用 Shell 写一个脚本,对文本中无序的一列数字排序,并求和
[root@CentOS64 datas]# touch number.txt [root@CentOS64 datas]# vim number.txt [root@CentOS64 datas]# cat number.txt 1 5 7 3 4 56 24 16 90 8 [root@CentOS64 datas]# sort -n number.txt | awk '{a+=$0;print$0}END{print "SUM="a}' 1 3 4 5 7 8 16 24 56 90 SUM=2141)请用 Shell 脚本写出查找当前文件夹下所有文本文件内容中包含有字符”jing"的文件名称
[root@CentOS64 datas]# grep -r "jing" /datas | cut -d ":" -f 1 /datas/sed.txt /datas/sed.txt /datas/cut.txt /datas/cut.txt