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

相关推荐
dpxiaolong30 分钟前
RK3588 Android12默认移除导航栏
开发语言·python
Pocker_Spades_A1 小时前
Python快速入门专业版(二十九):函数返回值:多返回值、None与函数嵌套调用
服务器·开发语言·python
良木林1 小时前
浅谈原型。
开发语言·javascript·原型模式
烈风1 小时前
004 Rust控制台打印输出
开发语言·后端·rust
一枝小雨2 小时前
【C++】list 容器操作
开发语言·c++·笔记·list·学习笔记
HMBBLOVEPDX2 小时前
C++(继承和多态)
开发语言·c++·继承和多态
yvya_2 小时前
JVM介绍
java·开发语言·jvm
rockmelodies2 小时前
【PHP7内核剖析】-1.1 PHP概述
开发语言·php
又菜又爱玩呜呜呜~2 小时前
go使用反射获取http.Request参数到结构体
开发语言·http·golang