我想從文件夾中的多個文本文件打印某些行,具體取決於文件名。考慮以下用下劃線分隔的3個單詞命名的文本文件:從多個文本文件中提取特定行
Small_Apple_Red.txt
Small_Orange_Yellow.txt
Large_Apple_Green.txt
Large_Orange_Green.txt
如何實現以下目標?
if (first word of file name is "Small") {
// Print row 3 column 2 of the file (space delimited);
}
if (second word of file name is "Orange") {
// print row 1 column 4 of the file;
}
這可能與awk?
這是用於Perl嗎? – amatek
@amatek是的。這是perl – mkHun