#include <stdio.h>
int main() {
char *str = "11111111-22222222 r-xp 00000000 00:0e 1843624 /lib/libdl.so.0";
unsigned long long start_addr, stop_addr, offset;
char* access = NULL;
char* filename = NULL;
sscanf(str, "%llx-%llx %m[-rwxp] %llx %*[:0-9a-f] %*d %ms",
&start_addr, &stop_addr, &access, &offset, &filename);
printf("\n start : %x, stop : %x, offset : %x\n",start_addr,stop_addr,offset);
printf("\n Permission : %s\n",access);
printf("\n Filename : %s\n",filename);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
在Linux上,这提供了正确的输出,但在Solaris上,该文件名为libdl.so(Solaris上没有libdl.so.0),所以我想知道是什么造成了这种差异,Solaris上没有这个文件,如果我改为Solaris安装的文件名(libdl.so)然后它会生成分段错误.
$ cc Cperm.c ;./a.out
Cperm.c: I funktion "main":
Cperm.c:11:3: varning: format "%x" förväntar sig argument av typen "unsigned …Run Code Online (Sandbox Code Playgroud) 我有一个配置了oracle的Sun OS服务器; 与数据库11g我想要备份,现在我在putty控制台上使用ssh连接到终端但是,我需要的是找到一种方法,使用批处理连接ssh到服务器然后登录然后登录到oracle然后采取备份,是可能的,如何.
我正在做一些我需要获取一些信息的东西kstat -p.所以我想创建一个包含所有输出的哈希变量kstat -p.
Sample output from kstat -p
cpu_stat:0:cpu_stat0:user 18804249
Run Code Online (Sandbox Code Playgroud)
访问值
@{$kstat->{cpu_stat}{0}{cpu_stat0}}{qw(user)};
Run Code Online (Sandbox Code Playgroud)
我也查看过任何可用模块的CPAN,Sun::Solaris::Kstat但是我的Sun版本不提供.请建议使用输出值创建哈希变量的代码kstat -p.
我想使用perl脚本从文件中读取一些参数.我用grep命令查找thoses参数的值.
#!/usr/bin/perl
if( scalar @ARGV ==0)
{
die "Number of argument is zero. Please use: perl <script_name> <cdc68.ini> \n";
}
if( !-f $ARGV[0]) ## if the 1st arg is not a file
{
die "$ARGV[0] is not a valid file type \nInput Arguments not correct!!! \n";
}
my $file_cnf=$ARGV[0];
my $DEST_PATH=`grep relogin_logs $file_cnf | cut -d "=" -f2`;
my $SRC_PATH=`grep dump_logs $file_cnf | cut -d "=" -f2`;
my $FINAL_LOG=`grep final_log $file_cnf | cut -d "=" -f2`;
print "\n$DEST_PATH \n $SRC_PATH …Run Code Online (Sandbox Code Playgroud) 您好我想将UNIX日期转换为正常日期(YYYY-MM-DD)
22222,0,0,0,14387
33333,0,0,0,14170
44444,0,0,0,14244
55555,0,0,0,14190
66666,0,0,0,14528
77777,0,0,0,14200
88888,0,0,0,0
99999,0,0,0,0
Run Code Online (Sandbox Code Playgroud)
这里第5列代表UNIX日期
我想转换成
22222,0,0,0,2009-05-23
Run Code Online (Sandbox Code Playgroud)
和类似的剩余行
有谁能够帮我