Sponsored Content
Top Forums Shell Programming and Scripting it's urgent ! round number in perl scripting Post 302339878 by pludi on Friday 31st of July 2009 03:37:21 PM
Old 07-31-2009
Generic, works in every language:
Code:
$number=int($number*1000)/1000;

 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help needed in shell scripting......urgent

Dear friends, please help me to solve following problem. I'm running a frontend application from which i'll be invoking the shell script with arguments as given below -driver -w -p "ABC XYZ" -S -ds con -dn "abc xyz" i am getting $1=-driver $2=-w $3=-p $4="ABC $5=XYZ" $6=-S $7=-ds... (3 Replies)
Discussion started by: swamymns
3 Replies

2. Shell Programming and Scripting

round a number

In a shell script - How do I round a decimal number (contained in a variable) to the nearest whole number? (2 Replies)
Discussion started by: achieve
2 Replies

3. Shell Programming and Scripting

Please help me out:-Its Urgent-C Shell Scripting

Hi Friends, I am new to this forum as well as new to shell scripting. I have a problem here and i need someone to solve this. Let us consider there are two processes(abc & def).There is a script which kills these two processes(i.e killtheprocess abc). Here abc is the argument . There... (0 Replies)
Discussion started by: Prince89
0 Replies

4. Shell Programming and Scripting

Umbrella Scripting(very Urgent)

Hi All, Can anybody help me to write the umbrella script for the following? I have three steps to do. STEP 1: CONVERT XML files to PS files STEP 2: CONVERT ALL PS FILES TO PDF FILES STEP 3: FTPING ALL PDF FILES TO THE SERVER. I have the codes for the above three steps. Now I... (6 Replies)
Discussion started by: sunitachoudhury
6 Replies

5. Shell Programming and Scripting

Urgent Korn Shell scripting Help Pleaaaase...

Hello All, Can someone help me to set a user's password from the script using korn shell. The password change is a one time password after user account creation. I tried providing the input file as the value for password field but password change requires tty so my password from an input file... (3 Replies)
Discussion started by: solaix14
3 Replies

6. Shell Programming and Scripting

Using sed to round a number

Hey everyone, I was wondering if i am able to write a sed command to round a number to two decimal places. So for example: 1.58674 would be 1.58 I just want to chop off the numbers to the right of the second digit after the period. I know this is probably trivial but the closest i got was... (8 Replies)
Discussion started by: GmGeubt
8 Replies

7. Shell Programming and Scripting

Need urgent help with PERL scripting

From the attached file I to need pick all rows that have AVG2 column value larger than 0.050, and write those values in to a separate file. Help me on how I pick the approp value & output them onto a file. Very Thanks in advance. :b: (5 Replies)
Discussion started by: tonystark
5 Replies

8. Shell Programming and Scripting

Round off Number in File

Hi Guys, i am having a csv file where i need to round off numerical column to 2 decimal precision in specific columns. i need to ignore the first two line i.e the header columns and manipulate rest of the lines of the csv file. My columns are specific i.e i need to round off only 2nd,4th and... (13 Replies)
Discussion started by: rohit_shinez
13 Replies
update-motd(5)							File Formats Manual						    update-motd(5)

NAME
update-motd - dynamic MOTD generation SYNOPSIS
/etc/update-motd.d/* DESCRIPTION
UNIX/Linux system adminstrators often communicate important information to console and remote users by maintaining text in the file /etc/motd, which is displayed by the pam_motd(8) module on interactive shell logins. Traditionally, this file is static text, typically installed by the distribution and only updated on release upgrades, or overwritten by the local administrator with pertinent information. Ubuntu introduced the update-motd framework, by which the motd(5) is dynamically assembled from a collection of scripts at login. Executable scripts in /etc/update-motd.d/* are executed by pam_motd(8) as the root user at each login, and this information is concatenated in /var/run/motd. The order of script execution is determined by the run-parts(8) --lsbsysinit option (basically alphabetical order, with a few caveats). On Ubuntu systems, /etc/motd is typically a symbolic link to /var/run/motd. BEST PRACTICES
MOTD fragments must be scripts in /etc/update-motd.d, must be executable, and must emit information on standard out. Scripts should be named named NN-xxxxxx where NN is a two digit number indicating their position in the MOTD, and xxxxxx is an appropriate name for the script. Scripts must not have filename extensions, per run-parts(8) --lsbsysinit instructions. Packages should add scripts directly into /etc/update-motd.d, rather than symlinks to other scripts, such that administrators can modify or remove these scripts and upgrades will not wipe the local changes. Consider using a simple shell script that simply calls exec on the external utility. Long running operations (such as network calls) or resource intensive scripts should cache output, and only update that output if it is deemed expired. For instance: /etc/update-motd.d/50-news #!/bin/sh out=/var/run/foo script="w3m -dump http://news.google.com/" if [ -f "$out" ]; then # Output exists, print it echo cat "$out" # See if it's expired, and background update lastrun=$(stat -c %Y "$out") || lastrun=0 expiration=$(expr $lastrun + 86400) if [ $(date +%s) -ge $expiration ]; then $script > "$out" & fi else # No cache at all, so update in the background $script > "$out" & fi Scripts should emit a blank line before output, and end with a newline character. For instance: /etc/update-motd/05-lsb-release #!/bin/sh echo lsb-release -a FILES
/etc/motd, /var/run/motd, /etc/update-motd.d SEE ALSO
motd(5), pam_motd(8), run-parts(8) AUTHOR
This manpage and the update-motd framework was written by Dustin Kirkland <kirkland@canonical.com> for Ubuntu systems (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3 published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. update-motd 13 April 2010 update-motd(5)
All times are GMT -4. The time now is 08:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy