开发者

replace a string in huge file by incrementing with it number of appearance in file?

I 开发者_StackOverflow中文版have a file of 500MB and it has strings :

  string_1 ..... string_500,

I need generate the copy of this file which has :

  string_501.......string_1000

I need to do this up to string_500000, what's the best way to solve this?


If it is literally as you describe, a constant string with variable suffixes then just generate the new file forgetting the old one.

If it's actually

wibble_1 something_2 that_3 changes_4 randomly_5

the I'd read and parse the thing in perl


If you just want to generate a sequence of strings (string_501 to string_500000), you can do this:

for i in `seq 501 500000`
do
    echo string_${i}
done
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜