Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

How to remove every other line with sed?

ls -l | sed '1~2d'
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 :: list files recursively 
Shell :: yii3 install 
Shell :: mc for ubuntu linux 
Shell :: sail command not found 
Shell :: vimeo status video 
Shell :: tar gzip compression level 
Shell :: how to move file from one directory to another in linux 
Shell :: tar-delete 
Shell :: find hidden directories and files from a website wfuzz 
Shell :: ubuntu drivers 
Shell :: how to remove all files with a certain file type in terminal 
Shell :: sed use match in replacement 
Shell :: crontab edit 
Shell :: shallow clone specific branch 
Shell :: composer install -- 
Shell :: ubuntu install safari browser terminal 
Shell :: Rename git branch while working in the branch 
Shell :: shell echo new line into file 
Shell :: run command every hour linux 
Shell :: open file command linux 
Shell :: upload transfer.sh 
Shell :: bash argument parsing 
Shell :: extracting tar.gz 
Shell :: docker-proxy port 80 
Shell :: how to compress files in powershell 
Shell :: how to undo a bunch of commit sent that was pushed 
Shell :: git remove large files with bfg 
Shell :: flutter desktop 
Shell :: linux change directory 
Shell :: nvm command 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =