1、

root@PC1:/home/test2# ls
a.txt  dir.1  test.csv  test.ped
root@PC1:/home/test2# ls -l
total 8
-rw-r--r-- 1 root root   64 1月  21 23:14 a.txt
drwxr-xr-x 2 root root 4096 1月  21 23:35 dir.1
-rw-r--r-- 1 root root    0 1月  21 23:35 test.csv
-rw-r--r-- 1 root root    0 1月  21 23:35 test.ped
root@PC1:/home/test2# ls -l | awk '{n=index($9,".")} {if($1!~/^[dt]/) print substr($9,1,n-1)}'   ## 列出所有文件的前缀
a
test
test

 

相关文章:

  • 2022-01-21
  • 2021-09-14
  • 2022-12-23
  • 2021-08-29
  • 2021-09-19
  • 2021-11-18
  • 2021-08-16
  • 2021-09-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-05
  • 2022-12-23
  • 2021-05-31
  • 2021-08-19
  • 2022-12-23
相关资源
相似解决方案