我有一个文本文件,我想在其中提取某些行。例如,保持行1:3删除行4:7并保持行8:10。理想情况下,新文本文件将是一个新文本文件,其名称中包含 _appended 。
我怀疑你会在终端中使用正则表达式,但我在正则表达式中有大约一个小时的知识。
操作系统:我在OS X上,合作伙伴在Windows 10上,我们有一台旧的慢速计算机,上面有最新的Ubuntu和Linux Mint。
*---------------------------------*
* GARCH Model Fit *
*---------------------------------*
Conditional Variance Dynamics
-----------------------------------
GARCH Model : eGARCH(1,1)
Mean Model : ARFIMA(0,0,0)
Distribution : norm
Optimal Parameters
------------------------------------
Estimate Std. Error t value Pr(>|t|)
mu -0.000035 0.000278 -0.12558 0.900064
omega -0.131803 0.012416 -10.61557 0.000000
alpha1 -0.104974 0.015901 -6.60185 0.000000
beta1 0.984519 0.001600 615.23328 0.000000
gamma1 0.106778 0.022386 4.76980 0.000002
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
mu -0.000035 0.000716 -0.048756 0.961114
omega -0.131803 0.038617 -3.413124 0.000642
alpha1 -0.104974 0.050081 -2.096092 0.036074
beta1 0.984519 0.005043 195.217257 0.000000
gamma1 0.106778 0.071636 1.490573 0.136074
LogLikelihood : 10033
Information Criteria
------------------------------------
Akaike -5.7897
Bayes -5.7808
Shibata -5.7897
Hannan-Quinn -5.7865
Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 1.368 0.24209
Lag[2*(p+q)+(p+q)-1][2] 3.404 0.10913
Lag[4*(p+q)+(p+q)-1][5] 5.817 0.09929
d.o.f=0
H0 : No serial correlation
Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 4.649 0.03108
Lag[2*(p+q)+(p+q)-1][5] 6.972 0.05267
Lag[4*(p+q)+(p+q)-1][9] 9.014 0.08075
d.o.f=2
Weighted ARCH LM Tests
------------------------------------
Statistic Shape Scale P-Value
ARCH Lag[3] 0.8635 0.500 2.000 0.3528
ARCH Lag[5] 2.1150 1.440 1.667 0.4464
ARCH Lag[7] 3.7967 2.315 1.543 0.3768
Nyblom stability test
------------------------------------
Joint Statistic: 0.7384
Individual Statistics:
mu 0.11217
omega 0.15329
alpha1 0.23532
beta1 0.14787
gamma1 0.06221
Asymptotic Critical Values (10% 5% 1%)
Joint Statistic: 1.28 1.47 1.88
Individual Statistic: 0.35 0.47 0.75
Sign Bias Test
------------------------------------
t-value prob sig
Sign Bias 0.82347 0.410299
Negative Sign Bias 0.08741 0.930353
Positive Sign Bias 2.58593 0.009752 ***
Joint Effect 7.08211 0.069326 *
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 69.83 9.802e-08
2 30 90.41 3.146e-08
3 40 107.39 2.628e-08
4 50 134.93 5.809e-10
Elapsed time : 0.3566
GARCH Model : eGARCH(1,1)
Mean Model : ARFIMA(0,0,0)
Distribution : norm
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
mu -0.000035 0.000716 -0.048756 0.961114
omega -0.131803 0.038617 -3.413124 0.000642
alpha1 -0.104974 0.050081 -2.096092 0.036074
beta1 0.984519 0.005043 195.217257 0.000000
gamma1 0.106778 0.071636 1.490573 0.136074
LogLikelihood : 10033
Information Criteria
------------------------------------
Akaike -5.7897
Bayes -5.7808
Shibata -5.7897
Hannan-Quinn -5.7865
Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 1.368 0.24209
Lag[2*(p+q)+(p+q)-1][2] 3.404 0.10913
Lag[4*(p+q)+(p+q)-1][5] 5.817 0.09929
d.o.f=0
H0 : No serial correlation
Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 4.649 0.03108
Lag[2*(p+q)+(p+q)-1][5] 6.972 0.05267
Lag[4*(p+q)+(p+q)-1][9] 9.014 0.08075
d.o.f=2
Asymptotic Critical Values (10% 5% 1%)
Joint Statistic: 1.28 1.47 1.88
Individual Statistic: 0.35 0.47 0.75
Sign Bias Test
------------------------------------
t-value prob sig
Sign Bias 0.82347 0.410299
Negative Sign Bias 0.08741 0.930353
Positive Sign Bias 2.58593 0.009752 ***
Joint Effect 7.08211 0.069326 *
答案 0 :(得分:1)
尝试:
sed '4,7d' your_file > your_file_appended
它将从文件中删除4-7行并将修改后的内容写入名为your_file_appended