need to remove 1st line of a file and save the file with same old name

Hi friends,

I have a doubt, I am not sure whether it is possible ah nu.

I am having a file(sample.txt) which contain 5 lines.

I want to remove 1st line in the file and save the file with same old name (sample.txt).

For removing 1st line i am using

sed 1d filename

But dono how to save that with same file name .:wall:

 
use -i with sed

using "sed -i" would alter the inode of the file.
using an "ed -s" instead would avoid this drawback.

printf "1d\nw\nq\n" | ed -s yourfile
1 Like

thanks a lot " ctsgnb ". It's working. . . .