溫馨提示×

linux如何去掉第一行

小億
85
2024-09-05 06:41:56
欄目: 智能運維

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

tail -n +2 input_file > output_file

這里,input_file是你要處理的文件名,output_file是去掉第一行后的新文件名。-n +2參數(shù)告訴tail從第二行開始輸出。

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

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

這將創(chuàng)建一個名為example_without_first_line.txt的新文件,其中不包含原始文件的第一行。

0