我有两个文件说(file1.dat, file2.dat)
file1.dat contains a line similar to
STR KAPPA2=0 RMAXS=4.2 NDIMIN=0 NOCALC=F IALPHA=0
file2.dat contains
class Fe convergency of s-channel= 0.347E-04
class Sr convergency of s-channel= 0.289E-04
class Bi convergency of s-channel= 0.111E-04
class Pt convergency of s-channel= 0.900E-04
我想获取的值,RMAXS (4.2)
然后convergency
将这些值存储在一个文件(say plot)
中, column wise
4.2 0.347E-04
4.2 0.289E-04
4.2 0.111E-04
4.2 0.900E-04
我可以获得单个值(使用grep
and awk
),但不知道如何以上述格式存储它们。
Also is there a way to print the shell variables like `$HOME` or
`$PWD` as the third column in the file (plot).