如何为google shell中的文件循环写入每行加3

时间:2017-12-04 06:57:44

标签: bash shell unix

enter image description here

你好,这是我在google shell中创建的文件。我希望每行增加三行,例如第一行将是699的699.我试图使用“while read line; do c =”line“c = c + 3”line“; done

1 个答案:

答案 0 :(得分:0)

您可以使用以下脚本:

Failed to execute the statement!You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= 'all' or 'cash'' at line 1

创建后,您需要向用户授予执行权限:

#!/bin/bash

while read -r line || [[ -n "$line" ]]; do
   echo $(($line+3));
done < "$1"

以下列方式调用之前:

chmod u+x my_script.sh

结果将保存在file.out。

中 祝你好运!

Usage

<强> TODO

当您的行不是数字或包含其他字符时进行错误管理。