Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

how to display specific lines from a file in linux

Write a bash script to print a particular line from a file:

awk = $ awk '{if(NR==LINE_NUMBER) print $0}' file.txt
sed = $ sed -n LINE_NUMBERp file.txt
Comment

show specific lines in file linux

$ cat sample_file.txt | awk 'NR==9'     #[Prints 9th line]
Comment

PREVIOUS NEXT
Code Example
Shell :: ss command in linux 
Shell :: find syntax in linux 
Shell :: docker run name container 
Shell :: create a new repository 
Shell :: how to install tar.xz file in ubuntu 
Shell :: ping port linux 
Shell :: git copy remote branch to local 
Shell :: rsync exclude directory 
Shell :: git change name 
Shell :: npm install sass-loader error 
Shell :: add cls as clear to bash 
Shell :: Dedian/Ubuntu Self Host Your Own Website for Free 
Shell :: How to Install and Configure doctl Github Download (Linux, MacOS) 
Shell :: bash read file and output 
Shell :: commandAndExit cts 
Shell :: Pull Changes From a Remote Repository in git command 
Shell :: Jager setup on Docker 
Shell :: iterate over dir and remove file bash 
Shell :: fish shell redirect stderr and stdout 
Shell :: ex: push a new local repository to github. 
Shell :: git pull remote branch that does not exist locally 
Shell :: find a match: docker-compose-plugin 
Shell :: how to Login Database Server as the root user 
Shell :: rm a var of $PATH ubuntu 
Shell :: Calculate float values with menu using bash script 
Shell :: change github release date 
Shell :: nc + bash 
Shell :: windows batch ping a range of addresses 
Shell :: "mkdir -p" exemple 
Shell :: install mysql majaro 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =