Bash Scripting Tutorial for Beginners - medium synoposis

Bash Scripting Tutorial for Beginners - medium synoposis

I) Website address

URL path

II) Transcript

2.15) SED

there will come a time where you want to change certain values in text files, and that's where sed or set comes in.

set is a command line tool that will allow you to modify values in a txt file using regular expressions. Let's have a look at an exact example on how to use 'sed' or 'set' to replace values in a text file.

Create a text file called settestdottxt. Let's write down some text here. Now we will replace the word fly with grasshopper, just for demonstration purposes.

so we type in sed, single quotes, s, forward slash , fly forward slash, grasshopper forward slash, G single quotes and then the name o our text file, which is settest dot txt.

Now the structure of this command is a little bit daunting, but let's break it down. First, we start off with the sed command, we open the single quotes and start our regular expression.

First we enter the mode we want to use, which is as for substitute, meaning we want to substitute the next word behind the forward slash with the word after the second forward slash, which is the First one is fly, and the second one is grasshopper.

That after the last, we provide the G which means that we want to do this globally. G stands for globally and globally means that you want to do this across the entire text file, which means that we want to change every occurrence, we close it

相关推荐
驭渊的小故事1 天前
订单服务如何调用商品服务?一次 RestTemplate 跨服务调用入门
java·开发语言·php
Sakura_j_h_1 天前
MCP SDK 2.0 实战:用 MCPServer 搭本地笔记检索服务
开发语言·笔记·python·qt·ai工具·mcp·mcpserver
微笑星河q1 天前
C++STL【vector】常用接口函数使用和迭代器失效问题
开发语言·c++
Eider19981 天前
Python基础语法之并发相关3
开发语言·python
FRing031 天前
vue2干货总结11(短信验证、登录功能、统一处理错误(响应拦截器)、将token信息存入vuex、vuex持久化处理)
开发语言·前端·javascript·vue.js·vue2
CS_Zero1 天前
DeepSeek V4.1 Flash 1017 (Batch) 新手极速上手指南
开发语言·batch·deepseek
山楂树の1 天前
Java 字符串高效处理:StringBuilder、StringBuffer、StringJoiner
java·开发语言
Risehuxyc1 天前
C# 发展历史
开发语言·c#
七夜zippoe1 天前
Nexent 知识库:调优靠 Chunk 与重排
开发语言·python·ai智能体·nexent·知识库与rag
kyle~1 天前
C# --- 反射
开发语言·c#