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 :: bash for file in directory 
Shell :: delete file with cmd 
Shell :: bash get files older than 
Shell :: github deploy server 
Shell :: dns_probe_finished_nxdomain ubuntu 
Shell :: what is a shebang line 
Shell :: how to change the apache port in xampp 
Shell :: Create and edit a new file nano 
Shell :: how to copy a file in ubuntu 
Shell :: find the process ID of a running process bash 
Shell :: Bash echo to standard output from function 
Shell :: To exclude directory with particluar pattern : 
Shell :: pretty print csv ubuntu terminal 
Shell :: git modify repository remote url 
Shell :: kills a process on port 
Shell :: Building without Cython. Error: Please make sure the libxml2 and libxslt development packages are installed. 
Shell :: cmake comment 
Shell :: installing ruby on rails ubuntu 20.04 
Shell :: falha ao instalar arquivo não há suporte ubuntu 
Shell :: ubuntu add entry to /etc/apt/sources.list 
Shell :: python-minimal has no installation candidate 
Shell :: how to find a collection mongo db 
Shell :: adb kill server kali linux 
Shell :: mark raid drive as removed linux 
Shell :: bash dynamic variable name 
Shell :: get ssm version 
Shell :: /etc/apt/sources.list 
Shell :: sort numbers in bash 
Shell :: install Dagger 2 in Android studio 
Shell :: install docker ce on centos 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =