cat "file.log"| grep -q '2013-11-10'
while read line
do
echo file_content_time=`echo $line | sed -e 's/\([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0- 9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\).*/\1/'`
if [ $? -eq 0 ]
then
echo comparison_start_date=`date -d "$file_content_time" +%Y%m%d`
fi
done < 'file.log'
/ *在这里,我正在尝试找出包含'2013-11-10'的行,并且从该行开始日期必须显示。* /
答案 0 :(得分:0)
要输出从包含模式的行到文件结尾的所有内容,只需
awk '/2013-11-10/,/pattern-not-in-file/' file.log
答案 1 :(得分:0)
awk '/pattern/{p=1}p' your_file
答案 2 :(得分:0)
initial_time = $(grep -o -m1“2013-11-10 [0-9] [0-9]:[0-9] [0-9]:[0-9] [0-9] “file.log)