1

I am having trouble with getting a file updated with the effect of a sed deletion.

when i perform the following, replacing <> with appropriate filename

sed '$d' <filename>

the immediate shell output shows the last line was deleted, but upon doing

cat <filename>

it shows that this deletion hasn't been stored, why is this?

Juju Head
  • 11
  • 3

1 Answers1

2

You need the -i flag to change the file in place. Without it, sed writes to standard output.

Jack
  • 5,801
  • 1
  • 15
  • 20