重新排序列的最佳方法是什么bash?
真实的例子:
我有文件ONE.txt包含:
firstName secondName telNumber
Run Code Online (Sandbox Code Playgroud)
我想从第一个文件创建文件SECOND.txt
secondName firstName telNubmer
Run Code Online (Sandbox Code Playgroud)
我怎么能做到这一点?(仅交换一行的列)
为什么我的程序不是 printf ?
先睡着然后写,但他应该反过来做。
#include <stdio.h>
#include <stdlib.h>
#ifdef _WIN32
#include <Windows.h>
#else
#include <unistd.h>
#endif
void sleepMilliSecond(long milliSecondInput) {
#ifdef _WIN32
Sleep(milliSecondInput); // v milliSecondach
#else
usleep(pollingDelay * 1000); //microsekundy -> milisekundy
#endif
}
int main(int argc, char** argv) {
printf("start sleep");
sleepMilliSecond(1000); //sleep 1s
printf("stop sleep");
return (EXIT_SUCCESS);
}
Run Code Online (Sandbox Code Playgroud)
程序的输出是:sleep 然后他写 start sleep stop sleep,为什么?
编辑: 工作解决方案是:
printf("start sleep");
fflush(stdout);
sleepMilliSecond(10000);
printf("stop sleep");
Run Code Online (Sandbox Code Playgroud)