- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Shell script to generate sequence number up to...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2005 05:15 AM
05-18-2005 05:15 AM
I need a shell script to create a file with the serial number starting from 1 to 10 million in the following format.
1, XXX, YYY
2, XXX, YYY
3, XXX, YYY
.
.
.
10 million.
We have filesystem with large file enabled, so big flat file shouldn’t be a problem.
Thanks for you anticipated help in advance.
Gulam.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2005 05:23 AM
05-18-2005 05:23 AM
Re: Shell script to generate sequence number up to 10 million.
typeset -i I=1
typeset -i STOP=10000000
while [[ ${I} -le ${STOP} ]]
do
echo "${I},XXX,YYY"
((I += 1))
done
Just redirect stdout to a file and you are done.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2005 05:28 AM
05-18-2005 05:28 AM
Re: Shell script to generate sequence number up to 10 million.
count=0
while [ $count -lt 1000000 ]
do
count=$(($count+1))
echo $count >> myFile
done
---
This will create myFile file with sequence 1 to 10000000. I guess it won't need largefiles to be enabled :)
Regards,
Fred
"Reality is just a point of view." (P. K. D.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2005 05:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2005 05:47 AM
05-18-2005 05:47 AM
Re: Shell script to generate sequence number up to 10 million.
Can I ask you one thing , what is difference between
typeset var=100
var=100
Thanks
BL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2005 05:56 AM
05-18-2005 05:56 AM
Re: Shell script to generate sequence number up to 10 million.
and
var=100
is not a pericularly good example because the default variable type is string
but
typeset -i var=100
and
var=100
are quite different.
The typeset -i lets the interpreter know that ${i} is an integer value so that optimized arithmatic operations can be done.
Besides, typesetting is simply good discipline. It's especially good in functions because you can now have real local variables that don't conflict with other variables of the same name.