我想將每個數字行與數值(例如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
...