I have a requirement of appending the string " 1"
at the end of every line of the file. After the execution of below two commands, an empty file is created.
awk '{ print $0 " 1" }' < file.txt > file.txt
using sed
sed 's/$/ 1/' file.txt > file.txt
What is the mistake attempted here, can you please advise ? I am executing these commands in mac terminal.