<分区>
我有一个文件的完整路径 hai/hello/home/something/file.txt
。我怎样才能得到 file.txt
作为输出消除完整路径?
如何使用 grep 做到这一点?
<分区>
我有一个文件的完整路径 hai/hello/home/something/file.txt
。我怎样才能得到 file.txt
作为输出消除完整路径?
如何使用 grep 做到这一点?
最佳答案
#!/usr/bin/perl
use File::Spec;
use File::Basename;
$n="hai/hello/home/something/file.txt";
my $m = basename $n;
print "$m";
关于linux - 使用 grep 进行模式匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19152606/