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

相关推荐
Whisper_Sy1 分钟前
Flutter for OpenHarmony移动数据使用监管助手App实战 - 月报告实现
android·开发语言·javascript·网络·flutter·ecmascript
灰灰勇闯IT2 分钟前
【Flutter for OpenHarmonyDart 入门日记】第5篇:字典类型 Map 与动态类型 dynamic 全解析
开发语言·javascript·ecmascript
leaves falling2 分钟前
c语言- 有序序列合并
c语言·开发语言·数据结构
雨季6664 分钟前
Flutter for OpenHarmony 入门实践:从 Scaffold 到 Container 的三段式布局构建
开发语言·javascript·flutter
Dreamy smile6 分钟前
JavaScript 继承与 this 指向操作详解
开发语言·javascript·原型模式
副露のmagic8 分钟前
更弱智的算法学习 day53
开发语言·python
HellowAmy8 分钟前
我的C++规范 - 回调的设想
开发语言·c++·代码规范
Java程序员威哥9 分钟前
SpringBoot多环境配置实战:从基础用法到源码解析与生产避坑
java·开发语言·网络·spring boot·后端·python·spring
mudtools12 分钟前
C#中基于Word COM组件的数学公式排版实践
开发语言·c#·word
Q741_14721 分钟前
C++ 优先级队列 大小堆 模拟 力扣 1046. 最后一块石头的重量 每日一题
开发语言·c++·算法·leetcode·优先级队列·