I am an iOS developer, not familiar with Linux, I searched for a long time but still could not solve my problem. I hope someone can help me, thanks!
Before delete:
Other contents......
#
# Proxy server for iTerm & Terminal Setup Script
# version 0.1
# VincentSit
# Nov 26, 2014
#
function start_proxy {
export http_proxy='abc.efgh.com:1234'
export HTTPS_PROXY='abc.efgh.com:1234'
}
function stop_proxy {
export http_proxy=''
export HTTPS_PROXY=''
}
Other contents......
After delete:
Other contents......
Other contents......
UPDATE
I'm writing a shell script(can not use other languages.). On users system has a text file named abc
, content is probably something like this:
# Other comments......
# Other comments......
# Other comments......
Other contents......
# Other comments......
#
# Proxy server for iTerm & Terminal Setup Script
# version 0.1
# VincentSit
# Nov 26, 2014
#
function start_proxy {
export http_proxy='abc.efgh.com:1234'
export HTTPS_PROXY='abc.efgh.com:1234'
}
function stop_proxy {
export http_proxy=''
export HTTPS_PROXY=''
}
# Other comments......
Other contents......
# Other comments......
# Other comments......
Which Other contents ......
is fictional, can not use it as deleted condition.
I just need to delete the following sections:
#
# Proxy server for iTerm & Terminal Setup Script
# version 0.1
# VincentSit
# Nov 26, 2014
#
function start_proxy {
export http_proxy='abc.efgh.com:1234'
export HTTPS_PROXY='abc.efgh.com:1234'
}
function stop_proxy {
export http_proxy=''
export HTTPS_PROXY=''
}
Do not need to delete other contents in this file.
Because it runs on the user's system, I do not know the line number of the contents I want to delete.
Finally look like this:
# Other comments......
# Other comments......
# Other comments......
Other contents......
# Other comments......
# Other comments......
Other contents......
# Other comments......
# Other comments......
I think the answer might look like this:
sed xxxxxx abc.txt
awk xxxxxx abc.txt