- 论坛徽章:
- 0
|
[root@localhost ~]# cat t
2010-07-14 19:14:49
2010-07-14 19:16:05
2010-07-14 19:16:23
2010-07-14 19:16:56
2010-07-14 21:35:84
2010-07-14 19:23:52
2010-07-14 19:24:15
2010-07-14 19:25:10
[root@localhost ~]# times=`who -u am i|awk '{print $3,$4}'`;echo "hh"|sed -n "s/hh/$times/"p
2010-07-14 21:35
[root@localhost ~]# times=`who -u am i|awk '{print $3,$4}'`;echo "hh"|sed "s/hh/$times/"p
2010-07-14 21:35
2010-07-14 21:35
[root@localhost ~]# sed -n '/2010-07-14 21:35/,$'p t
2010-07-14 21:35:84
2010-07-14 19:23:52
2010-07-14 19:24:15
2010-07-14 19:25:10
[root@localhost ~]# times=`who -u am i|awk '{print $4}'`;sed -n "/$times/,$"p t
sed: -e expression #1, char 26: unterminated address regex
[root@localhost ~]# times=`who -u am i|awk '{print $4}'`;sed -n "/${times}/,$"p t
\sed: -e expression #1, char 26: unterminated address regex
[root@localhost ~]# times=`who -u am i|awk '{print $4}'`;sed -n "/${times}/,\$"p t
sed: -e expression #1, char 26: unterminated address regex
请问我该如何替换呢 |
|