- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- while script
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
01-01-2007 06:19 PM
01-01-2007 06:19 PM
while script
131648
131648
131648
107640
98880
98880
98880
82496
82496
82496
82496
82496
82240
82240
82112
74304
74304
74304
74304
74048
74048
74048
Above lines should be mutiplied by 4096 each.
I want to get calculated value.
which script is it fit for?
I want to thank you in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2007 07:03 PM
01-01-2007 07:03 PM
Re: while script
You can try simple for loop for this. Store this list in a file say a.txt and then run following command
for i in $(cat a.txt)
do
bc $i*4096 >>/tmp/a.out
done
You will get output in /tmp/a.out
Sunil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2007 07:10 PM
01-01-2007 07:10 PM
Re: while script
#!/usr/bin/ksh
for i in `cat test.txt`
do
ii=$(( $i / 4096 ));
print $ii;
done
regards,
ivan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2007 09:07 PM
01-01-2007 09:07 PM
Re: while script
as you asked for a while statement:
#!/usr/bin/sh
while read a
do
echo `expr $a \* 4096`
done < a.lis
The script reads one line at a time from a.lis and multiplies the read amount by 4096.
The "\" before the multiplication sign is to make it clear to the shell that you want to use the "*" as a multiplication sign.
You can amend the echo statement to re-direct output and/or display the read value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2007 11:10 PM
01-01-2007 11:10 PM
Re: while script
awk '{print 4096*$1}' old.txt > new.txt
perl -ple '$_ *= 4096' old.txt > new.txt
fwiw,
Hein.