首页 > 系统相关 >Linux bash sed command All In One

Linux bash sed command All In One

时间:2022-10-25 15:25:14浏览次数:206  
标签:www sed command https commit txt com bash

Linux bash sed command All In One

sed

sed, a stream editor

sed,流编辑器

awk, Perl

https://www.gnu.org/software/sed/manual/sed.html

# sed SCRIPT INPUTFILE...

# to replace all occurrences of ‘hello’ to ‘world’ in the file input.txt:

$ sed 's/hello/world/' input.txt > output.txt

# The following commands are equivalent:

$ sed 's/hello/world/' input.txt > output.txt

$ sed 's/hello/world/' < input.txt > output.txt

$ cat input.txt | sed 's/hello/world/' - > output.txt

blogs

Linux sed 命令

Linux sed 命令是利用脚本来处理文本文件。

sed 可依照脚本的指令来处理编辑文本文件。

Sed 主要用来自动编辑一个或多个文件、简化对文件的反复操作、编写转换程序等。

# 语法
$ sed [-hnV][-e<script>][-f<script文件>][文本文件]

https://www.runoob.com/linux/linux-comm-sed.html

https://www.computerhope.com/unix/used.htm

https://phoenixnap.com/kb/linux-sed

https://www.geeksforgeeks.org/sed-command-in-linux-unix-with-examples/

https://www.howtogeek.com/666395/how-to-use-the-sed-command-on-linux/

https://www.interviewkickstart.com/learn/sed-command-in-linux-unix-with-examples

demos

git hooks

commit-msg

#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message.  The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit.  The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".

# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"

# This example catches duplicate Signed-off-by lines.

test "" = "$(grep '^Signed-off-by: ' "$1" |
	 sort | uniq -c | sed -e '/^[ 	]*1[ 	]/d')" || {
	echo >&2 Duplicate Signed-off-by lines.
	exit 1
}


XSS

#!/bin/bash

sed -i "s/xssor.io/$1/g" xssor/payload/probe.js

python3 manage.py runserver 0.0.0.0:8000

https://github.com/evilcos/xssor2/blob/master/run.sh

refs

https://www.cnblogs.com/xgqfrms/tag/sed

https://www.cnblogs.com/xgqfrms/p/16243419.html



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载

标签:www,sed,command,https,commit,txt,com,bash
From: https://www.cnblogs.com/xgqfrms/p/16824934.html

相关文章