Answers for "echo lines to file bash"

1

bash script to output a specific line of a file

/**
* A bash script to print at stdout line_number from file_name
* @line_number: the line number you want to print
* @file_name: the file you want to read from
*/

awk '{if(NR==line_number) print $0}' file_name
Posted by: Guest on August-19-2021
2

echo to file bash

echo "I am "Finding" difficult to write this to file" > file.txt
echo "I can "write" without double quotes" >> file.txt

echo "This is a test to write $PATH in my file" >> file.txt
echo 'This is a test to write '"$PATH"' in my file' >> file.txt

tee -a file.txt <<EOF

I am "Finding" difficult to write this to file
I can "write" without double quotes
EOF
Posted by: Guest on February-23-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language