簡體   English   中英

Shell腳本讀取文件范圍?

[英]Shell script to read range of files?

我創建了1000個文件,名稱分別為:15_file1、15_file2 ... 15_file1000。

我希望僅從15_file1到15_file300讀取300個文件。

我有一個shell腳本:

fmount=/opt/insiteone/fuse-mount/ifm/Dir1/*

for myFiles in $fmount
do
      cat $myFiles  2>&1 | tee -a readFile.log &
done

但這將讀取所有文件,以這種模式如何只讀取其中的300個?

取消使用變量,並說:

for myFiles in /opt/insiteone/fuse-mount/ifm/Dir1/15_file{1..300}

您可以使用shell進行循環:

for i in {1..10}
> do
> echo $i
> done
1
2
3
4
5
6
7
8
9
10

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM