阅读“.inf”使用perl文件并搜索字符串。 [英] Reading ".inf" file and search for a string using perl.

查看:104
本文介绍了阅读“.inf”使用perl文件并搜索字符串。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下命令使用perl程序创建.inf文件。



system(secedit / export / areas USER_RIGHTS / cfg。$ path) ;



接下来,我想打开这个文件并搜索一个字符串。但是打开这个文件时,它不是以标准格式打开而是以其他格式打开,每个字母空间之间都会出现,所以它无法搜索该字符串。

我需要将此文件编码为utf -8。



怎么做???



我尝试过:



我尝试使用此代码对我的文件进行编码,但它无法正常工作,



我的$ hdlFile = open(我的$ fh,<:encoding(UTF-8),$ strFilePath)

||死无法打开UTF-8编码$ strFilePath:$!;

I am creating ".inf" file using following command using perl program.

system("secedit /export /areas USER_RIGHTS /cfg ".$path);

Next, I want to open this file and search for a string. But while opening this file it is not opening in standard format rather some other format,between each letter space is coming, so it was not able to search that string.
I need to encode this file to utf-8.

How to do this???

What I have tried:

I tried this code to encode my file, but it is not working,

my $hdlFile = open(my $fh, "<:encoding(UTF-8)", $strFilePath)
|| die "Can't open UTF-8 encoded $strFilePath: $!";

推荐答案

路径);



接下来,我想打开这个文件并搜索一个字符串。但是打开这个文件时,它不是以标准格式打开而是以其他格式打开,每个字母空间之间都会出现,所以它无法搜索该字符串。

我需要将此文件编码为utf -8。



怎么做???



我尝试过:



我尝试使用此代码对我的文件进行编码,但它无法正常工作,



my
path);

Next, I want to open this file and search for a string. But while opening this file it is not opening in standard format rather some other format,between each letter space is coming, so it was not able to search that string.
I need to encode this file to utf-8.

How to do this???

What I have tried:

I tried this code to encode my file, but it is not working,

my


hdlFile = open(my
hdlFile = open(my


fh,<:encoding(UTF-8),
fh, "<:encoding(UTF-8)",


这篇关于阅读“.inf”使用perl文件并搜索字符串。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆