shell

Makefile 怎么写

2023-12-24 gaoch
当一个目标需要执行多个命令时,可以在 Makefile 中为该目标提供多行命令。每一行命令都必须以制表符开始。以下是一个简单的示例: all: clean build run clean: rm -f my_program build: gcc -Wall -o my_program main.c util.c run: ./my_program 在这个示例中: […] 你可以使用以 … 阅读全文 →

使用shell删除文本中的重复行

2011-07-16 gaoch
使用uniq命令得到不重复的行 现有文件如下: ————————————————— my friends, chenhong my friends, chenhong my friends, chenhong my teacher, liyong my teacher, liyong my teacher, liyong my father, wuzhongyi my father, … 阅读全文 →

Ubuntu linux下Shell批量重命名文件的实例

2010-12-12 gaoch
将当前目录下面的php文件全部改写为html文件 [bash] for it in *.php; do mv $it “$it.pdf”; done [/bash] 将文件名中的URL转义字符%2E修正为点号. 有时候下载的文件名中含有URL的转义字符,如%2E,%2F等 参见附录:URL转义字符。 [bash] for it in `ls *.pdf|grep “%2E”`; do mv $it … 阅读全文 →