SQL> DELETE * FROM ABC;
RAM
SQL> DELETE * FROM LMN;
RAJ
我想在 RAJ 和第一个模式之间以相反的顺序提取数据 SQL> 找到
需要输出:
SQL> DELETE * FROM LMN;
RAJ
答案 0 :(得分:0)
tac file.txt|sed -n '/^RAJ/,/^SQL>/p'|tac
示例file.txt
SQL>DELETE *FROM ABC;
RAM
SQL>DELETE *FROM LMN;
RAJ
SQL>DELETE *FROM CDE;
RAM
SQL>DELETE *FROM XYZ;
RAJ
结果:
SQL>DELETE *FROM LMN;
RAJ
SQL>DELETE *FROM XYZ;
RAJ