Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

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
Source by leetcode.com #
 
PREVIOUS NEXT
Tagged: #bash #script #output #specific #line #file
ADD COMMENT
Topic
Name
2+3 =