我想将每个数字行与数值(例如2)相乘,除了行有标题(带空格的字符行)。在linux/awk/bash中仅将行与数值相乘
Input.file
fixedStep chrom=chr1 start=9992 step=1
3
6
10
23
...
fixedStep chrom=chr1 start=11166 step=1
2
4
6
...
期望输出
fixedStep chrom=chr1 start=9992 step=1
6
12
20
46
...
fixedStep chrom=chr1 start=11166 step=1
4
8
12
...
我的代码:
while read line; do echo 2*$line; done <Input.file | bc
此代码乘法完美,但不留头,因为它是。谁能帮忙?我的代码
输出示例:
(standard_in) 1: illegal character: S
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
6
12
20
46
...