假设我有以下内容file.txt
:
asiub
sj
abq
b aia
ainp oo
test = 123d
sub ,.
aiba 87ab
test = 129szs bq
test = aqua
ayqvq 133s
我只想打印file.txt
包含字符串的行test =
。
想要的output.txt
:
test = 123d
test = 129szs bq
test = aqua
有什么建议吗?
谢谢
假设我有以下内容file.txt
:
asiub
sj
abq
b aia
ainp oo
test = 123d
sub ,.
aiba 87ab
test = 129szs bq
test = aqua
ayqvq 133s
我只想打印file.txt
包含字符串的行test =
。
想要的output.txt
:
test = 123d
test = 129szs bq
test = aqua
有什么建议吗?
谢谢
我正在尝试ncdf4
使用由 shell 脚本运行的 R 脚本将 R 包安装到远程计算机中。
我尝试安装其他软件包,它工作正常,但ncdf4
它没有软件包。
我的 R 脚本如下:
install.packages('ncdf4', repos = "http://cran.us.r-project.org")
shell脚本的输出是:
^LInstalling package into ‘/my/directory/R/x86_64-pc-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'http://cran.us.r-project.org/src/contrib/ncdf4_1.16.tar.gz'
Content type 'application/x-gzip' length 121420 bytes (118 KB)
==================================================
downloaded 118 KB
* installing *source* package ‘ncdf4’ ...
** package ‘ncdf4’ successfully unpacked and MD5 sums checked
configure.ac: starting
checking for nc-config... no
-----------------------------------------------------------------------------------
Error, nc-config not found or not executable. This is a script that comes with the
netcdf library, version 4.1-beta2 or later, and must be present for configuration
to succeed.
If you installed the netcdf library (and nc-config) in a standard location, nc-config
should be found automatically. Otherwise, you can specify the full path and name of
the nc-config script by passing the --with-nc-config=/full/path/nc-config argument
flag to the configure script. For example:
./configure --with-nc-config=/sw/dist/netcdf4/bin/nc-config
Special note for R users:
-------------------------
To pass the configure flag to R, use something like this:
R CMD INSTALL --configure-args="--with-nc-config=/home/joe/bin/nc-config" ncdf4
where you should replace /home/joe/bin etc. with the location where you have
installed the nc-config script that came with the netcdf 4 distribution.
-----------------------------------------------------------------------------------
ERROR: configuration failed for package ‘ncdf4’
* removing ‘/my/directory/R/x86_64-pc-linux-gnu-library/3.3/ncdf4’
The downloaded source packages are in
‘/tmp/RtmpJLxXFq/downloaded_packages’
Warning message:
In install.packages("ncdf4", repos = "http://cran.us.r-project.org") :
installation of package ‘ncdf4’ had non-zero exit status
Error in library(ncdf4) : there is no package called ‘ncdf4’
Execution halted
你以前遇到过这个问题吗?有什么建议吗?
谢谢
我目前正在尝试通过 shell 脚本运行 R 脚本。
这里是 R 脚本:
test = rnorm(1:100, 1000)
write.csv(test, 'test.csv')
这里是调用 R 的 bash 脚本:
#!/bin/bash -l
#SBATCH --partition=compute
#SBATCH --job-name=test
#SBATCH --mail-type=ALL
#SBATCH [email protected]
#SBATCH --time=00:10:00
#SBATCH --nodes=1
#SBATCH --tasks-per-node=12
#SBATCH --account=myaccount
module purge
module load R
${HOME}/test.R
我想我做的一切都正确,但输出返回以下错误:
/mydirectory/test.R: line 3: syntax error near unexpected token `('
/mydirectory/test.R: line 3: `test = rnorm(1:100, 1000)'
为什么我会收到此错误?