Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

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 :: laptop slow performance linux 
Shell :: install live-server via npm 
Shell :: bash write file 
Shell :: arch linux 
Shell :: Cache Your Login Credentials 
Shell :: ubuntu show git branch in terminal 
Shell :: debian bullseye sources.list security 
Shell :: scp download file 
Shell :: create a vpn server linux 
Shell :: git remove last commit origin 
Shell :: install zsh with powerlevel10k customization addon 
Shell :: linux sort by file size 
Shell :: remove unused images docker manually 
Shell :: echo or cat into multiple files 
Shell :: find folder size in linux 
Shell :: git check current brach 
Shell :: create anaconda environment in shell 
Shell :: git set token 
Shell :: certbot expand certificate 
Shell :: dynamodb local how to delete table 
Shell :: “git force rebase abort” 
Shell :: how to debug wirless android 
Shell :: git pull remote branch 
Shell :: how to install python on linux/terminal 
Shell :: delete heroku remote 
Shell :: install chrome ubuntu automatic update 
Shell :: shell open program 
Shell :: find process on linux 
Shell :: how to download terminator in ubuntu 
Shell :: docker fatal: not a git repository (or any of the parent directories): .git 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =