shell脚本分号
发布时间: 2023-08-23 15:05:00
‘壹’ 怎么设置 linux环境变量配置
1、直接用export命令:
#export PATH=$PATH:/opt/au1200_rm/build_tools/bin
查看是否已经设好,可用命令export查看:
[root@localhost bin]# export
declare -x BASH_ENV="/root/.bashrc"
declare -x G_BROKEN_FILENAMES="1"
declare -x HISTSIZE="1000"
declare -x HOME="/root"
declare -x HOSTNAME="localhost.localdomain"
declare -x INPUTRC="/etc/inputrc"
‘贰’ shell脚本如何将文件多行根据分号拼接为一行
Hello,这个题目如果是linux必须要用linux三剑客了.
[root@g01files]#catsql.txt
createtabletest.two
(
pnvarchar(10)notnull
);
createtabletest.aa
(
pnvarchar(10)notnull
);
createtabletest.bb
(
pnvarchar(10)notnull
);
createtabletest.ccc
(
pnvarchar(10)notnull
);
方法1
[root@g01files]#awk'{if(/);/)print;elseprintf$0" "}'sql.txt
createtabletest.two(pnvarchar(10)notnull);
createtabletest.aa(pnvarchar(10)notnull);
createtabletest.bb(pnvarchar(10)notnull);
createtabletest.ccc(pnvarchar(10)notnull);
方法2
[root@oldboye-show01/server/files]#awk-vRS=");"-F" "'{print$1,$2,$3,$4,RT}'sql.txt
createtabletest.two(pnvarchar(10)notnull);
createtabletest.aa(pnvarchar(10)notnull);
createtabletest.bb(pnvarchar(10)notnull);
createtabletest.ccc(pnvarchar(10)notnull);
热点内容