亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 2164 | 回復(fù): 5
打印 上一主題 下一主題

Perl小白求助,如何將如下文本搬到excel里 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2017-01-09 14:16 |只看該作者 |倒序?yàn)g覽
1. Total power consumption
==========================

                                                              Power(Watts)
Power contribution                                      Static  Dynamic    Total
----- ------------                                      ------  -------    -----
Internal power
   Internal register power      240uW    275nW    240uW
   Internal latch power        2.46uW   50.8nW   2.51uW
   Internal memory power           0W       0W       0W
   Other internal power         188uW    451nW    189uW
   Total internal power                                  431uW    776nW    431uW
Pad power                                                   0W       0W       0W
Clock power                                             13.3uW   35.2uW   48.5uW
Inferred Buffer power                                   23.5uW    480pW   23.5uW


Total power                                              467uW     36uW    503uW

2. Total power per supply
=========================

將標(biāo)綠的部分搬到表格中

論壇徽章:
0
2 [報(bào)告]
發(fā)表于 2017-01-09 15:47 |只看該作者

while (<>){
        s/(.*?)([\w|\.]+)\s+([\w|\.]+)\s+([\w|\.]+)$/$1\t$2\t$3\t$4/g;
        print "$_\n";
}

論壇徽章:
0
3 [報(bào)告]
發(fā)表于 2017-01-09 18:55 |只看該作者
回復(fù) 2# yuxi1988

現(xiàn)在變量進(jìn)入了$1,$2,$3,$4,怎樣一行一行搬到excel里呢

論壇徽章:
307
程序設(shè)計(jì)版塊每周發(fā)帖之星
日期:2016-04-08 00:41:33操作系統(tǒng)版塊每日發(fā)帖之星
日期:2015-09-02 06:20:00每日論壇發(fā)貼之星
日期:2015-09-02 06:20:00程序設(shè)計(jì)版塊每日發(fā)帖之星
日期:2015-09-04 06:20:00每日論壇發(fā)貼之星
日期:2015-09-04 06:20:00每周論壇發(fā)貼之星
日期:2015-09-06 22:22:00程序設(shè)計(jì)版塊每日發(fā)帖之星
日期:2015-09-09 06:20:00程序設(shè)計(jì)版塊每日發(fā)帖之星
日期:2015-09-19 06:20:00程序設(shè)計(jì)版塊每日發(fā)帖之星
日期:2015-09-20 06:20:00每日論壇發(fā)貼之星
日期:2015-09-20 06:20:00程序設(shè)計(jì)版塊每日發(fā)帖之星
日期:2015-09-22 06:20:00程序設(shè)計(jì)版塊每日發(fā)帖之星
日期:2015-09-24 06:20:00
4 [報(bào)告]
發(fā)表于 2017-01-09 19:00 |只看該作者
你這個(gè)文本直接用 Excel 打開,應(yīng)該就能識(shí)別成 csv 格式文件, 另存下不就行了。

論壇徽章:
0
5 [報(bào)告]
發(fā)表于 2017-01-10 08:47 |只看該作者
回復(fù) 3# junweitao


腳本貼到
to_excel.pl,你的report貼到比如說power.rpt

命令行執(zhí)行
##$> to_excel.pl power.rpt

然后復(fù)制屏幕的輸出,貼到excel就可以啦,我試了一下沒問題

#to_excel.pl

while (<>){
        s/(.*?)([\w|\.]+)\s+([\w|\.]+)\s+([\w|\.]+)$/$1\t$2\t$3\t$4/g;
        print "$_\n";
}
#power.rpt
Power contribution                                      Static  Dynamic    Total
----- ------------                                      ------  -------    -----
Internal power
   Internal register power      240uW    275nW    240uW
   Internal latch power        2.46uW   50.8nW   2.51uW
   Internal memory power           0W       0W       0W
   Other internal power         188uW    451nW    189uW
   Total internal power                                  431uW    776nW    431uW
Pad power                                                   0W       0W       0W
Clock power                                             13.3uW   35.2uW   48.5uW
Inferred Buffer power                                   23.5uW    480pW   23.5uW


Total power                                              467uW     36uW    503uW

論壇徽章:
0
6 [報(bào)告]
發(fā)表于 2017-01-17 17:02 |只看該作者
#!/usr/bin/perl
use strict;
use warnings;
use Spreadsheet::WriteExcel;
my $filename='1.xls';
my $workbook=Spreadsheet::WriteExcel->new($filename);
my $worksheet=$workbook->add_worksheet();
my @a;
while(<DATA>){
if(/^[a-zA-Z]/){
my @b=split /\s{2,}/;
push @a,[@b];
}
}
$worksheet->write_col('A1',\@a);
__DATA__
1. Total power consumption
==========================
                               Power(Watts)
Power     contribution      Static  Dynamic    Total
-----     ------------      ------  -------    -----
Internal  power
Internal  register power     240uW    275nW    240uW
Internal  latch power        2.46uW   50.8nW   2.51uW
Internal  memory power       0W       0W       0W
Other     internal power     188uW    451nW    189uW
Total     internal power     431uW    776nW    431uW
Pad       power              0W       0W       0W
Clock     power              13.3uW   35.2uW   48.5uW
Inferred  Buffer power       23.5uW    480pW   23.5uW
Total     power              467uW     36uW    503uW
2. Total power per supply
=========================
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP