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

using sed to remove part of a line using EOL

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

PREVIOUS NEXT
Code Example
Shell :: turbo top for linux 
Shell :: powershell rename group 
Shell :: run antlr 
Shell :: zsh: permiso denegado: /home/sebastian/.bash_aliases 
Shell :: how to mninimoze all windows ubntu 
Shell :: Cannot create files/folders in new partition 
Shell :: ffmpeg whatsapp or telegram format 
Shell :: ????ip l2tp add tunnel 
Shell :: ubuntu sysmon 
Shell :: cant find typesizes.h 
Shell :: standard notes for x64 linux 
Shell :: when-i-start-ubuntu-it-enters-tty1-6-instead-of-my-desktop-how-do-i-get-to-de/65234#65234 
Shell :: remove ms store remove installed app 
Shell :: git push rebase 
Shell :: batch copy and replace code 
Shell :: run flluter,linux 
Shell :: exclude folder with gunzip linux 
Shell :: output text after specific character powershell 
Shell :: install coreutils 
Shell :: cambiare luminosità schermo ubuntu 
Shell :: freetype2 linux install 
Shell :: kill: (31229): No such process 
Shell :: sharepoint list password column 
Shell :: busca de ficheiro em linux sem access denied e com data 
Shell :: linux-shutdown-befehle 
Shell :: install webex with wine 
Shell :: linux run command on ssh connected 
Shell :: windows launch node with variables 
Shell :: 2 chaves ssh 
Shell :: dokuwiki debug log 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =