Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

generate data

Status
Not open for further replies.

ksdh

Technical User
Oct 24, 2007
41
0
0
IN
HI
I am looking to generate 1 million records as under
272000000001,38129031,982123,0000001
404000000001,38129031,982123,4000001
303000000001,38129031,982123,3000001
282000000001,38129031,982123,1000001
272000000002,38129031,982123,0000002
404000000002,38129031,982123,4000002
303000000002,38129031,982123,3000002
282000000021,38129031,982123,1000002

What would be the best way to do that? i know the seq would not work since it can be used for only one type.
 
Hi

Supposing your last sample line is a typo :
Code:
for ((i=1;i<=100000;i++)); do
  printf "272000%06d,38129031,982123,0%06d\n404000%06d,38129031,982123,4%06d\n303000%06d,38129031,982123,3%06d\n282000%06
d,38129031,982123,1%06d\n" $i $i $i $i $i $i $i $i
done

Feherke.
 
Thanks Ferheke but is this a bash script?
 
The reason i am asking you that is , the output is as under
': invalid format character
282000272000016810,38129031,982123,0016810
404000016810,38129031,982123,4016810
303000016810,38129031,982123,3016810
-bash: printf: `
 
Hi

Sorry, I had to say that there are 3 lines, so the [tt]printf[/tt] should by 1 line. Let us rewrite it abit :
Code:
for ((i=1;i<=100000;i++)); do
  printf "272000%06d,38129031,982123,0%06d
404000%06d,38129031,982123,4%06d
303000%06d,38129031,982123,3%06d
282000%06d,38129031,982123,1%06d
" $i $i $i $i $i $i $i $i
done

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top