I am created file use "cat > sample.txt". after i used "cat -b sample.txt". how to save it. ctrl+x or F2 is not working.cat -b command
Asked
Active
Viewed 59 times
0
cat -b sample.txt > sample.txt
will not work. In fact it will destroy the file. That's because bash will process the redirection first (truncating the file to zero bytes) before launching the cat command. – glenn jackman Mar 24 '20 at 16:37cat -b sample.txt > tempfile && mv tempfile sample.txt
– glenn jackman Mar 24 '20 at 16:38moreutils
package andcat -b sample.txt | sponge sample.txt
– glenn jackman Mar 24 '20 at 16:42