Sedang Disiapkan

shell script that add and delete lines from a file

Hello, I need two shell scripts, one can add lines to a file use variable such as $domain, and the other shell script can delete lines in the file use similar variable such as $domain.

The file will contain records format as:

IPaddress Domain

192.168.1.1 [url removed, login to view]

192.168.1.1 [url removed, login to view]

192.168.1.1 [url removed, login to view]

192.168.1.1 [url removed, login to view]

192.168.1.1 [url removed, login to view]

192.168.1.1 [url removed, login to view]

...

The script that adds have to do a search first see if the exact record exists or not, if not, then append it to the end of the file.

The script that deletes also have to do a search first see if the exact record exists or not, if exist then delete the record.

For example, the variable $domain passed in is [url removed, login to view], then the add script will need to append "192.168.1.1 domain.com" without the quotes at the end of the file, the delete script will need to search for "192.168.1.1 domain.com" this exact string and if a line match it exactly then delete that line.

Budget will be low since the project should be simple.

Thanks

Forgot one thing, I also need another script that can read in a file contains domain names such as:
www.domain.com domain.com domain2.com...
seperated by space or an enter(newline)
and output a file in this format:
192.168.1.1 www.domain.com
192.168.1.1 domain.com
192.168.1.1 domain2.com
....

Thanks. sorry for those who have already placed bid for adding this.

Kemahiran: Linux

Lihat lebih lanjut: shell script delete line, shell script delete lines file, shell script remove lines file, shell script add line file, shell script add lines file, shell script remove line, add lines file shell script, delete line file shell, delete lines shell script, delete line contain exact file shell script, adding lines file shell script, shell script remove domain, script remove line, shell remove lines cut, delete line files linux, delete line shell script, delete lines file shell script, shell script remove select file, script delete line file, shell remove line file, shell script delete files, shell script delete line file, find delete line file shell script, shell script projects free, deleting lines shell script

Tentang Majikan:
( 4 ulasan ) Shanghai, United States

ID Projek: #110643