我发现了一种我无法用 awk 真正解释的行为。也许这是一个愚蠢的错误,但我无法弄清楚。
我有一个名为 files 的文件,其中有一些随机文件名。
$ cat -e files
3beds.txt$
file4.txt$
file3.txt$
dedo$
file5.txt$
texto5.txt$
metoo.txt$
34lions$
texto2.txt$
file1.txt$
7hello$
summer$
missing$
hello.mundo$
helloWorld.txt$
texto3$
awkvars$
texto4$
yes$
file2.txt$
Run Code Online (Sandbox Code Playgroud)
我只想打印包含数字的文件名。我使用了命令:
awk '/\d/{print $0}' files
Run Code Online (Sandbox Code Playgroud)
但我的结果是:
$ awk '/\d/{print $0}' files
3beds.txt
dedo
hello.mundo
helloWorld.txt
Run Code Online (Sandbox Code Playgroud)
如果有人能向我解释为什么要打印这些行,我将非常感激。谢谢你!
我正在努力用cuda制作我的第一个节目.所以我用各种页面的指南制作这个简单的HelloWorld.
#include <cstdlib>
#include <cstdio>
#include <cuda.h>
using namespace std;
__global__ void mykernel(void) {
}
int main(void) {
mykernel<<<1,1>>>();
printf("CPU Hello World!\n");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
但我得到这个输出:
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/sebastian/Dropbox/Universidad/Trabajo_de_Grado_pregrado/Codigos/HelloWordCuda'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/hellowordcuda
make[2]: Entering directory `/home/sebastian/Dropbox/Universidad/Trabajo_de_Grado_pregrado/Codigos/HelloWordCuda'
mkdir -p build/Debug/GNU-Linux-x86
rm -f "build/Debug/GNU-Linux-x86/hellowordcuda.o.d"
g++ -c -g -I/usr/local/cuda-7.5/include -MMD -MP -MF "build/Debug/GNU-Linux-x86/hellowordcuda.o.d" -o build/Debug/GNU-Linux-x86/hellowordcuda.o hellowordcuda.cpp
hellowordcuda.cpp:19:1: error: ‘__global__’ does not name a type
__global__ void mykernel(void) {
^
hellowordcuda.cpp: In function ‘int main()’:
hellowordcuda.cpp:24:1: …Run Code Online (Sandbox Code Playgroud)