0

Suppose there are 200 files in /tmp

e.g.: {abc1xyz,abc2xyz,abc3xyz..abc200xyz}

I want to write "hello" in the files from abc38xyz to abc53xyz

akshay
  • 1
  • Would you want to overwrite the contents of the files, or would you want to insert the word on a particular line? – Kusalananda Feb 16 '17 at 11:10
  • I want to over write the file. they may be empty also. – akshay Feb 16 '17 at 11:19
  • its just a example. if there are 2000 files from that i want to add "test" work in files from 333 to 1987. i cannot do it manually . i want to do it in single command – akshay Feb 16 '17 at 11:22

2 Answers2

3

Using bash or ksh93:

$ echo "hello" | tee /tmp/abc{38..53}xyz
Kusalananda
  • 333,661
0
for file in /tmp/abc{38..53}xyz;
do
    echo "hello" >"$file";
done;

might work

FloHe
  • 860