随笔分类 - Script
摘要:linux 命令行查询 awk 用法信息 awk --help Usage: awk [POSIX or GNU style options] -f progfile [--] file ... Usage: awk [POSIX or GNU style options] [--] 'progra
阅读全文
摘要:linux 命令行查询 grep 用法信息 sed --help Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]... -n, --quiet, --silent suppress automatic prin
阅读全文
摘要:linux 命令行查询 grep 用法信息 grep --help Usage: grep [OPTION]... PATTERNS [FILE]... Search for PATTERNS in each FILE. Example: grep -i 'hello world' menu.h m
阅读全文
摘要:在 C 语言中,有很多种基本的数据类型,如bool char, int, long, float, double 等。在 Python 中,可以使用 struct 模块来解码这些类型的二进制表示。 以下是 C 语言中的常见类型以及对应的 Python 解码方法: C 语言类型及其 Python 解码
阅读全文
摘要:按行拼接两个文件 awk 'NR==FNR{a[NR]=$0;next}{print $0,a[FNR]}' B.txt A.txt >C.txt 注:文件格式须为unix,dos格式拼接后会跨行 在指定格式的文件中查找字符串 在指定格式的文件中查找字符串 grep -nr "string" --i
阅读全文
摘要:本意是想获取代码仓相对路径,代码如下 base_dir=`pwd` repo forall -c '{ user_dir=base_dir" "user_dir }' 执行后报错 realpath: '': No suc
阅读全文
摘要:# 指定文件 dodo_path=/home/skull/work/scripts/dodo echo "hello skull" ## COMP_WORDS 是一个 bash 内建的数组变量,它包含了当前命令行中的所有单词 # 例如,如果你输入了 dodo make,那么 COMP_WORDS 就
阅读全文
摘要:🐶输入参数包含 'arg-m' 时,会输出 Hit Arg-M 和 Hit Arg-N [[ {EXEC_PARAMS[@]} =~ 'arg-n' ]] && echo "Hit
阅读全文
摘要:参数获取 EXEC_PARAMS=({@:0}) ./do.sh test a b c d e f EXEC_PARAMS=(${@:1}) test a b c d e f EXEC_PAR
阅读全文
摘要:@echo off set /p src_suffix=please input origin suffix: set /p des_suffix=please input target suffix: :: 递归 变量 通配符 扩展到文件名 for /r %%a in (*.%src_suffix
阅读全文
摘要:百分比进度指示,原地踏步效果实现主要利用退格'\b',同行'\c' #!/bin/bash function percentage_progress() { progress=1*100/progress -lt 10 ];then echo -e "${progres
阅读全文
摘要:查找包含字符串“skull”的目录、在找出的路径中找出格式“.c/.cpp/.h”的文件、并统计出数量 find . -path ./out -prune -o -iname "skull" -print | xargs -I % find % -iname *.[c,cpp,h] | wc -l
阅读全文
摘要:跨行内容查找、替换、删除 sed '/START-TAG/{:a;N;/END-TAG/!ba};/ID: 222/d' data.txt /START-TAG/ { # Match 'START-TAG' :a # Create label a N # Read next line into pa
阅读全文