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

相关推荐
Godson_beginner18 小时前
Sa-Token (java权限认证框架)
java·开发语言
谢景行^顾18 小时前
numpy
开发语言·python·numpy
敲代码的瓦龙18 小时前
操作系统相关的一些问题总结
linux·c语言·开发语言
牛奔18 小时前
php 8.2 配置安装php-zbarcode扩展
android·开发语言·php
Fcy64818 小时前
C++ 模版(进阶)(含array解析)
开发语言·c++·stl·array·模版
OKkankan19 小时前
多态概念及使用
开发语言·数据结构·c++·算法
hudawei99619 小时前
kotlin协程编译成Android字节码后是什么样的
android·开发语言·kotlin
小周码代码19 小时前
js 数字金额转为大写 js 金额转大写
开发语言·前端·javascript·js工具
行走在电子领域的工匠19 小时前
台达ST:自定义串行通讯传送与接收指令COMRS程序范例五
开发语言·台达plc·st语言编程·串口自定义协议
BillKu19 小时前
html2pdf.js使用与配置详解
开发语言·javascript·ecmascript