Linux sed -i.bak: In-Place File Editing with Backup
The command "sed -i.bak" in Linux is used to edit files in-place using the sed command, while creating a backup of the original file with the .bak extension. The -i option is used to edit files in-place, meaning the changes are made directly to the file without creating a new file. The .bak extension is added after the -i option to specify that a backup of the original file should be created with the .bak extension. For example, if you have a file named "example.txt" and you run the command "sed -i.bak 's/foo/bar/' example.txt", it will replace all occurrences of "foo" with "bar" in the "example.txt" file. At the same time, it will create a backup of the original file named "example.txt.bak".
原文地址: https://www.cveoy.top/t/topic/pZGT 著作权归作者所有。请勿转载和采集!