⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 substring-extraction.sh

📁 Shall高级编程
💻 SH
字号:
#!/bin/bash# substring-extraction.shString=23skidoo1#      012345678    Bash#      123456789    awk# Note different string indexing system:# Bash numbers first character of string as '0'.# Awk  numbers first character of string as '1'.echo ${String:2:4} # position 3 (0-1-2), 4 characters long                                         # skid# The awk equivalent of ${string:pos:length} is substr(string,pos,length).echo | awk '{ print substr("'"${String}"'",3,4)      # skid}'#  Piping an empty "echo" to awk gives it dummy input,#+ and thus makes it unnecessary to supply a filename.exit 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -