I was doing some hands-on with the Unix sed command. I was trying out the substitution and append command, in a file. But the difficulty is, I have to create an intermediate file, and then do mv to rename it to the original file.
Is there any way to do it at one shot in the same file?
[root@dhcppc0 practice]# sed '1i\
> Today is Sunday
> ' file1 > file1
[root@dhcppc0 practice]# cat file1
[root@dhcppc0 practice]#
The file is deleted!
[root@dhcppc0 practice]# sed 's/director/painter/' file1 > file1
[root@dhcppc0 practice]# cat file1
The file is deleted!