我有一个txt文件..这是GFF文件的结果...你们中的任何一个人都可以指出我如何在另一列中找到特定字符串及其旁边的值吗?
答案 0 :(得分:0)
您需要读取文件(通常是逐行)以找出内部的内容。
答案 1 :(得分:0)
好吧,我假设您的GFF文件是根据这些specifications 在这种情况下,您可以使用以下命令逐行读取文件(并拆分列以获取数组):
// Open the file
$file = fopen('your_file.txt', 'r');
// Go over the lines
while (!feof($file)) {
$line = fgets($file);
$parts = preg_split('/\s+/', $line);
// Check if cds is found in one of the parts
$cds = search('cds', $parts);
// We found one
if ($cds !== false) {
// Get the next value
$value = $parts[$cds + 1];
// Do something with it
}
}