Answers for "write line in 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
-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 "Shell/Bash"

Browse Popular Code Answers by Language