learn Linux sed command
learn Linux sed command 一、参考文档:
. sed命令详解
http://qifuguang.me/2015/09/21/sed%E5%91%BD%E4%BB%A4%E8%AF%A6%E8%A7%A3/
. linux之sed用法
http://www.cnblogs.com/dong008259/archive/2011/12/07/2279897.html
. Sed 的man手册参数详细解释(一)
http://blog.csdn.net/imfinger/article/details/6071175 二、sed命令的使用规则是这样的:
sed [option] 'command' input_file 三、options:
-n, --quiet, --silent
suppress automatic printing of pattern space
-e script, --expression=script
add the script to the commands to be executed
如果命令行上只有一个指令的时候可以不用写-e,但是如果有多个指令的话一定要在每个指令的前面加-e选项。
-f script-file, --file=script-file
add the contents of script-file to the commands to be executed
这里貌似是前面对应的-e对应的脚本
--follow-symlinks
follow symlinks when processing in place
-i[SUFFIX], --in-place[=SUFFIX]
edit files in place (makes backup if extension supplied)
-l N, --line-length=N
specify the desired line-wrap length for the `l' command
--posix
disable all GNU extensions.
-r, --regexp-extended
use extended regular expressions in the script.
-s, --separate
consider files as separate rather than as a single continuous
long stream.
-u, --unbuffered
load minimal amounts of data from the input files and flush the
output buffers more often
--help
display this help and exit
--version
output version information and exit 四、command有以下几种:
a \: append即追加字符串, a \的后面跟上字符串s(多行字符串可以用\n分隔),则会在当前选择的行的后面都加上字符串s;
c \: 取代/替换字符串,c \后面跟上字符串s(多行字符串可以用\n分隔),则会将当前选中的行替换成字符串s;
d : delete即删除,该命令会将当前选中的行删除;
i \: insert即插入字符串,i \后面跟上字符串s(多行字符串可以用\n分隔),则会在当前选中的行的前面都插入字符串s;
p : print即打印,该命令会打印当前选择的行到屏幕上;
s : 替换,通常s命令的用法是这样的:,2s/old/new/g,将old字符串替换成new字符串
learn Linux sed command的更多相关文章
- Linux sed command
概述 sed 是一种在线非交互式编辑器,它一次处理一行内容. 处理时,把当前处理的行存储在临时缓冲区中,称为"模式空间"(pattern space). 接着用sed命令处理缓冲区 ...
- Linux sed Examples--转载
原文地址:https://www.systemcodegeeks.com/shell-scripting/bash/linux-sed-examples/?ref=dzone Sed is basic ...
- linux sed命令参数及用法详解
linux sed命令参数及用法详解 http://blog.csdn.net/namecyf/article/details/7336308 1. Sed简介 sed 是一种在线编辑器,它一次处理一 ...
- Linux sed命令使用方法
sed(Stream Editor)是Linux中文本处理使用非常广泛的工具,可以对文件内容进行替换.删除.新增.选取特定行等功能.下面通过sed常用实例介绍sed命令的使用方法. sed基本语法 s ...
- 理解linux sed命令
理解linux sed命令(2010-02-27 18:21:20) 标签:linuxshellsed替换 分类:革命本钱 1. Sed简介sed是一种在线编辑器,它一次处理一行内容.处理时,把当 前 ...
- Linux sed 替换第一次出现的字符串
/********************************************************************************* * Linux sed 替换第一次 ...
- Linux:-bash: ***: command not found
Linux:-bash: ***: command not found,系统很多命令都用不了,均提示没有此命令. 突然之间linux很多命令都用不了,均提示没有此命令. 这应该是系统环境变量出现了问题 ...
- linux sed 批量替换多个文件中的字符
格式: sed -i "s/查找字段/替换字段/g" `grep 查找字段 -rl 路径` linux sed 批量替换多个文件中的字符串 sed -i "s/oldst ...
- 轻松学会文本处理工具之二 linux sed命令
sed命令的语法格式: sed的命令格式: sed [option] 'sed command'filename sed的脚本格式:sed [option] -f 'sed script'fil ...
随机推荐
- 如何使用curl进行网页授权
答:使用curl的-u选项,使用方法如下 curl -u username URL (会提示输入密码)
- Oracle修改表结构
--添加字段 alter table [tablename] add [column name] [column data type]; --修改字段数据类型 alter table [tablen ...
- .Net Core Cookie跨站点共享 会话保持
这里使用简单粗暴的方式,只为做个记录. 关键配置: services.AddDataProtection() .SetApplicationName("appname") .Dis ...
- 分析java进程假死状况
摘自: http://www.myexception.cn/internet/2044496.html 分析java进程假死情况 1 引言 1.1 编写目的 为了方便大家以后发现进程假死的时候能够正常 ...
- ZeroMq实现跨线程通信
ZeroMq实现跨线程通信 之前在技术崇拜的技术经理指导下阅读了ZeroMq的基础代码,现在就将阅读的心得与成果记录一下,并重新模仿实现了一下经理的异步队列. 1.对外接口 //主要接口(1)void ...
- canvas实现鼠标拖拽矩形移动改变大小
项目的一个新需求,动态生成矩形框,鼠标点击拖动改变矩形框的位置,并可以调整大小. 之前做过一个小demo,需求类似,但是在canvas内只有一个矩形框,拖动移动,当时记得是用isPointInPath ...
- UTF-8文件的Unicode签名BOM(Byte Order Mark)问题记录(EF BB BF)
背景 楼主测试的批量发送信息功能上线之后,后台发现存在少量的ERROR日志,日志内容为手机号码格式不正确. 此前测试过程中没有出现过此类问题,从运营人员拿到的发送列表的TXT,号码是符合规则的,且格式 ...
- SpringBoot学习(1)
内容概要: spring data springboot是spring团队基于spring4开发的一个框架. springboot来简化spring应用开发,约定大于配置,去繁从简,just run就 ...
- 手机APP测试环境搭建---appium
这些都不是重点---一切都可以参考虫师 Appium移动自动化测试(一)--安装Appium 1.ADB的安装:ADB(ANDROID DEBUG BRIDGE) 应用场景: 针对移动端 Andr ...
- LabVIEW之生产者/消费者模式--队列操作
LabVIEW之生产者/消费者模式--队列操作 彭会锋 本文章主要是对学习LabVIEW之生产者/消费者模式的学习笔记,其中涉及到同步控制技术-队列.事件.状态机.生产者-消费者模式,这几种技术在在本 ...