Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

sed remove line containing

sed '/pattern to match/d' ./infile
Comment

delete a line starting with sed

# Delete all lines starting with '#'
$ sed -i '/^#/d' filepath
Comment

delete line in sed

# -i here update the file, try with and without -i, 
sed -i -e '/yourpattern/,$d' file # delete everyhing afer the pattern
sed '/yourpattern/d' file   #delete pattern containing line
sed -i -e "/your_pattern/,+2 d" file  # 2 lines after the pattern
sed -i -e "5,5d" file # remove 5th line
sed '10,$d' pes.com # delete everything after 10th line
sed '7,36!d' tmp.com > tmp_coord # specific lines to a file
sed -i '$d' file # delete last line
sed -i -e '29,36d' pes.com delete specific lines 
sed -i -e '78r../../insert_file' File_you_change.txt   #sed interst lines to a file
sed 's/^........//' delete chars 1st to x in ANY line, ... = charachters 
Comment

sed remove line

$ sed 's|http://||' <<EOL
http://url1.com
http://url2.com
http://url3.com
EOL
Comment

PREVIOUS NEXT
Code Example
Shell :: grep exclude multi dirs 
Shell :: instal ng2 search module 
Shell :: how delete branch from specific origin 
Shell :: vim colorscheme 
Shell :: Make a backup of the database with SSH 
Shell :: stress-ng install on redhat 
Shell :: bash if not 
Shell :: xargs curl url 
Shell :: interact with docker container shell 
Shell :: git clone only single file 
Shell :: tar append 
Shell :: ansible playbook to set passwordless sudo 
Shell :: docker-compose.yml ubuntu 
Shell :: install cypress for nextjs 
Shell :: git create branch and checkout one command 
Shell :: how to kill process in linux 
Shell :: install serial port using npm 
Shell :: zsh shell in linux 
Shell :: magento 2.4 install command line 
Shell :: append a string in all files name linux 
Shell :: index of string in shell 
Shell :: pip install six 
Shell :: extract a tar file in linux 
Shell :: move all subfolders to parent folder linux 
Shell :: scaffold controller ef core 
Shell :: undo revert commit 
Shell :: what to do with the git config 
Shell :: copy command 
Shell :: openjdk-17-jdk 
Shell :: how to use curl command in ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =