随笔分类 -  Script

摘要:linux 命令行查询 awk 用法信息 awk --help Usage: awk [POSIX or GNU style options] -f progfile [--] file ... Usage: awk [POSIX or GNU style options] [--] 'progra 阅读全文
posted @ 2024-10-22 11:45 壹点灵异 阅读(46) 评论(0) 推荐(0) 编辑
摘要:linux 命令行查询 grep 用法信息 sed --help Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]... -n, --quiet, --silent suppress automatic prin 阅读全文
posted @ 2024-10-22 09:26 壹点灵异 阅读(122) 评论(0) 推荐(0) 编辑
摘要:linux 命令行查询 grep 用法信息 grep --help Usage: grep [OPTION]... PATTERNS [FILE]... Search for PATTERNS in each FILE. Example: grep -i 'hello world' menu.h m 阅读全文
posted @ 2024-10-21 20:31 壹点灵异 阅读(56) 评论(0) 推荐(0) 编辑
摘要:在 C 语言中,有很多种基本的数据类型,如bool char, int, long, float, double 等。在 Python 中,可以使用 struct 模块来解码这些类型的二进制表示。 以下是 C 语言中的常见类型以及对应的 Python 解码方法: C 语言类型及其 Python 解码 阅读全文
posted @ 2024-08-20 16:25 壹点灵异 阅读(67) 评论(0) 推荐(0) 编辑
摘要:按行拼接两个文件 awk 'NR==FNR{a[NR]=$0;next}{print $0,a[FNR]}' B.txt A.txt >C.txt 注:文件格式须为unix,dos格式拼接后会跨行 在指定格式的文件中查找字符串 在指定格式的文件中查找字符串 grep -nr "string" --i 阅读全文
posted @ 2024-05-27 14:16 壹点灵异 阅读(8) 评论(0) 推荐(0) 编辑
摘要:本意是想获取代码仓相对路径,代码如下 base_dir=`pwd` repo forall -c '{ user_dir=(realpathrelativeto="base_dir" "PWD")echouser_dir }' 执行后报错 realpath: '': No suc 阅读全文
posted @ 2024-01-17 12:16 壹点灵异 阅读(88) 评论(0) 推荐(0) 编辑
摘要:# 指定文件 dodo_path=/home/skull/work/scripts/dodo echo "hello skull" ## COMP_WORDS 是一个 bash 内建的数组变量,它包含了当前命令行中的所有单词 # 例如,如果你输入了 dodo make,那么 COMP_WORDS 就 阅读全文
posted @ 2023-01-05 17:36 壹点灵异 阅读(275) 评论(0) 推荐(0) 编辑
摘要:🐶输入参数包含 'arg-m' 时,会输出 Hit Arg-M 和 Hit Arg-N [[ {EXEC_PARAMS[@]} =~ 'arg-m' ]] && echo "Hit Arg-M" || [[{EXEC_PARAMS[@]} =~ 'arg-n' ]] && echo "Hit 阅读全文
posted @ 2022-11-25 16:51 壹点灵异 阅读(36) 评论(0) 推荐(0) 编辑
摘要:参数获取 EXEC_PARAMS=(@:index)./do.shtestabcdefEXECPARAMS=({@:0}) ./do.sh test a b c d e f EXEC_PARAMS=(${@:1}) test a b c d e f EXEC_PAR 阅读全文
posted @ 2022-09-26 16:28 壹点灵异 阅读(542) 评论(0) 推荐(0) 编辑
摘要:@echo off set /p src_suffix=please input origin suffix: set /p des_suffix=please input target suffix: :: 递归 变量 通配符 扩展到文件名 for /r %%a in (*.%src_suffix 阅读全文
posted @ 2022-08-31 13:49 壹点灵异 阅读(63) 评论(0) 推荐(0) 编辑
摘要:百分比进度指示,原地踏步效果实现主要利用退格'\b',同行'\c' #!/bin/bash function percentage_progress() { progress=((1*100/2))if[progress -lt 10 ];then echo -e "${progres 阅读全文
posted @ 2022-02-28 10:19 壹点灵异 阅读(118) 评论(0) 推荐(0) 编辑
摘要:查找包含字符串“skull”的目录、在找出的路径中找出格式“.c/.cpp/.h”的文件、并统计出数量 find . -path ./out -prune -o -iname "skull" -print | xargs -I % find % -iname *.[c,cpp,h] | wc -l 阅读全文
posted @ 2022-02-25 11:15 壹点灵异 阅读(1072) 评论(0) 推荐(0) 编辑
摘要:跨行内容查找、替换、删除 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 阅读全文
posted @ 2022-02-18 15:16 壹点灵异 阅读(377) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示