我有一个shell脚本。我想打开一个文件,并从文件中复制一些文本。例如:在文件中查找文本值,将其打印出来?
// foo.java
public static int ID_RED = 100;
public static int ID_GREEN = 200;
public static int ID_BLUE = 300;
//伪代码:
int pos = find("public static int ID_RED = ");
echo(file.substring(pos, end of line);
pos = find("public static int ID_GREEN = ");
echo(file.substring(pos, end of line);
pos = find("public static int ID_BLUE = ");
echo(file.substring(pos, end of line);
//所需的输出:
100
200
300
所以我想开富。 java,并打印出在这些行结尾处找到的值。我觉得这是比较容易做到这一点的Perl或Python,想看看是否有一个简单的方法在一个shell脚本来完成这一点,虽然,