- 论坛徽章:
- 0
|
1、文本处理脚本如下:
---------------------------------------------------
#!/bin/bash
yeday_file=$1
today_file=$2
yeday_time=$(echo ${yeday_file:0:8})
today_time=$(echo ${today_file:0:8})
awk -F, '{print $1}' $today_file|uniq|sed '/^.*Time.*$/d'|sed "0,/235959/s/\(.*\)/${yeday_time}\1/g"|sed "/000000/,$s/\(.*\)/${today_time}\1/g"|sed "/${today_time}05.*/,$d"|sed 's/[0-9][0-9]
$//g' >temp_$today_file
---------------------------------------------------
2、sed加双引号引用了变量,导致了行尾符$加上后面的英文字符也被识别成了变量,试过了好几种办法无果,问题虽小,但也很蛋疼,多谢~ |
|