温馨提示×

linux如何去掉第一行

小亿
85
2024-09-05 06:41:56
栏目: 智能运维

在Linux中,你可以使用tail命令来去掉文件的第一行

tail -n +2 input_file > output_file

这里,input_file是你要处理的文件名,output_file是去掉第一行后的新文件名。-n +2参数告诉tail从第二行开始输出。

例如,如果你有一个名为example.txt的文件,你可以使用以下命令去掉第一行:

tail -n +2 example.txt > example_without_first_line.txt

这将创建一个名为example_without_first_line.txt的新文件,其中不包含原始文件的第一行。

0