我有從命令輸出陣列如下寫不同線從陣列到兩個不同的文件
@flows =
--------
Code: Message id 'com.test.mb.TestHarness' on execution group 'GENERALEG' is running.
Additional thread instances: '0'
Deployed: '6/4/13 9:54 AM' in Bar file '/home/test/deploy/GENERALEG/TestHarness_2013-06-04_09-54- 30.bar'
Last edited: '6/4/13 9:53 AM'.
Long description: ''
User-defined property names:
Keywords:
--------
Code: Message id 'com.test.mb.TestHarness1' on execution group 'GENERALEG' is running.
Additional thread instances: '0'
Deployed: '10/5/13 9:56 AM' in Bar file '/home/test/deploy/GENERALEG/TestHarness1_2013-10-05_09-56-30.bar'
Last edited: '10/5/13 9:55 AM'.
Long description: ''
User-defined property names:
Keywords:
--------
Code: Message id 'com.cims.utility.Test' on execution group 'GENERALEG' is stopped.
Additional thread instances: '0'
Deployed: '5/20/13 4:27 AM' in Bar file '/home/test/deploy/GENERALEG/TestDecodeDEV_2013-05-20_04-27-53.bar'
Last edited: '5/20/13 2:55 PM'
Long description: ''
User-defined property names:
Keywords:
有一堆更類似的路線。 我的代碼當前正在寫入一個文件後代碼文本:消息ID'並採取它的狀態。 我的代碼
open $file, '>>', "$LogDir/snglflows.txt";
foreach $_ (@flows)
{
next if /^(\s)*$/;
if (/Code: Message id '(.*?)' .* running/)
{
print $file "$1,started\n";
}
elsif (/Code: Message id '(.*?)' .* stopped/)
{
print $file "$1,stopped\n";
}
}
close $file;
但這段代碼是給我輸出到snglflows.txt文件如下
com.test.mb.TestHarness,started
com.test.mb.TestHarness1,started
com.cims.utility.Test,stopped
有沒有辦法可以得到兩個文件。一個snglflows.txt文件和其他人喜歡flowbars.txt與bar文件信息如下
/home/test/deploy/GENERALEG/TestHarness_2013-06-04_09-54-30.bar
/home/test/deploy/GENERALEG/TestHarness1_2013-10-05_09-56-30.bar
/home/test/deploy/GENERALEG/TestDecode_2013-05-20_04-27-53.bar
你可以做的更清楚。你在每個文件中需要什麼? – Sobrique 2014-11-06 19:52:12
在一個文件中,snglflows.txt我需要爲'com.test.mb.TestHarness輸出,開始 com.test.mb.TestHarness1,開始 com.cims.utility.Test,stopped' 在其他文件中, flowbars.txt我需要輸出爲'/home/test/deploy/GENERALEG/TestHarness_2013-06-04_09-54-30.bar /home/test/deploy/GENERALEG/TestHarness1_2013-10-05_09-56-30.bar /home/test/deploy/GENERALEG/TestDecode_2013-05-20_04-27-53.bar' – user3164754 2014-11-06 20:32:13