Answers for "linux add line to file"

6

bash add text to file

echo "hello world" >> my_file.txt
Posted by: Guest on February-24-2020
0

add line at beginning of file unix

sed -i '1s/^/your textn/' file #Note the addition of the "n" for concluding the new line after the insertion
Posted by: Guest on September-20-2021
-1

linux write each line from file to new file

for line in $(cat file.txt); do echo "${line}" > "directory/filename_${i}.txt"; i=$(( $i + 1 )); done
Posted by: Guest on April-02-2021

Code answers related to "linux add line to file"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language