小编pha*_*ani的帖子

如何使用awk忽略空行和注释行

我正在写这段代码:

awk -F'=' '!/^$/{arr[$1]=$2}END{for (x in arr) {print x"="arr[x]}}' 1.txt 2.txt
Run Code Online (Sandbox Code Playgroud)

此代码忽略空行,但我也想忽略以#(注释)开头的行.

知道如何添加多个模式吗?

regex linux bash awk

4
推荐指数
2
解决办法
2万
查看次数

从另一个shell脚本只调用一个函数

cat global_features_script.sh

.child1_script.sh
.child2_script.sh

    function svn_credentials
    {
        echo -n "Enter the svn username and press [ENTER]: " > /dev/tty
        read svn_username
        echo -n "Enter the svn commit message and press [ENTER]: "  > /dev/tty
        read svn_message
        echo -n "Enter your svn password and press [ENTER]: "  > /dev/tty
        read -s svn_password
    }
    if [ a == b]
    then
    echo "a is equal to be b"
    else
    echo "a is not equal to b"
    fi

    function exit_error
    {
    echo " There …
Run Code Online (Sandbox Code Playgroud)

linux bash shell inheritance function

1
推荐指数
1
解决办法
4220
查看次数

标签 统计

bash ×2

linux ×2

awk ×1

function ×1

inheritance ×1

regex ×1

shell ×1