Sponsored Content
Full Discussion: Using printf in bash
Top Forums UNIX for Dummies Questions & Answers Using printf in bash Post 302751777 by Scrutinizer on Friday 4th of January 2013 12:26:00 PM
Old 01-04-2013
Code:
num="1234567890"
echo "${num#?????}"

 

10 More Discussions You Might Find Interesting

1. Programming

printf

What is the output of the following program considering an x86 based parameter passing sequence where stack grows towards lower memory addresses and that arguments are evaluated from right to left: int i=10; int f1() { static int i = 15; printf("f1:%d ", i); return i--; } main() {... (2 Replies)
Discussion started by: arunviswanath
2 Replies

2. Shell Programming and Scripting

printf

How to print output in following format? A..................ok AA................ok AAA..............ok AAAAAA........ok "ok" one under one (4 Replies)
Discussion started by: mirusnet
4 Replies

3. Shell Programming and Scripting

printf in bash shell not printing negative values

hi i am using printf in a script and it is not printing negative values..i have to use printf to get rid of the newline..here is my code: fin=`echo $a - $b | bc` printf "${fin}," >> test these statements are in a loop. here is what i get when i try to subtract 4 from 8: ./scr1: line... (2 Replies)
Discussion started by: npatwardhan
2 Replies

4. Shell Programming and Scripting

[bash]printf octal instead of decimal

Hello everybody, I would like to understand why the printf function is returning me an octal value with this command : printf %4.4d 0010 returns 0008 printf %4.4d 10 returns 0010 Thanks for help. (3 Replies)
Discussion started by: dolphin06
3 Replies

5. UNIX for Dummies Questions & Answers

Need help with printf

Hi, I have just completed my first script (:D) and now i just need to format it with printf. This is what I have: #!/bin/ksh TOTB=0 TOTF=0 TOTI=0 HOST=`hostname` echo " FSYSTEM BLKS FREE INUSE MOUNTEDON" df -m | grep -v ":"|grep -v Free|grep -v "/proc"| while read FSYSTEM... (2 Replies)
Discussion started by: compan023
2 Replies

6. Shell Programming and Scripting

AWK printf help

Target file contains short text (never more than 1 line) and filenames. The format is, e.g.,: TEXT1 filename1 TEXT2 TEXT3 filename3dddd filename3dddd TEXT4 filename4 TEXT5 filename5dddd filename5dddd filename5 where dddd is a random 4-digit whole number. Desired output: (4 Replies)
Discussion started by: uiop44
4 Replies

7. Shell Programming and Scripting

floating point not recognized by printf in bash

Dear all, I have the following question. Let's say that I have the following script #!/bin/bash value=0.4987865 a=` printf "%6.2f" $value ` b=`echo $value + $value | bc -l` echo $a echo $b exit And the exit is: 0,00 .9975730 Thus, the problem is that the printf order does not... (2 Replies)
Discussion started by: josegr
2 Replies

8. Programming

working of printf()

hello all, i came accross an aptitude question .. int main() { int a = 10, b = 20, c = 30; printf("%d\t%d\t%d"); } it gives output 30 20 10 what is the reason of such behaviour of printf(). thank you. (7 Replies)
Discussion started by: zius_oram
7 Replies

9. UNIX for Beginners Questions & Answers

How to use printf in bash

Hello, this is my first time on the forum. I seem to not have the ability to start a new thread. However, I have a very simple question. I am trying to write a script I have to use printf to say "My name is myname (pulled from $USER) . it works with echo, but with printf the $USER... (2 Replies)
Discussion started by: sheltie042
2 Replies

10. Shell Programming and Scripting

Problem running plsql using printf command on bash shell

I am running plsql using printf on a shell, but i am getting some strange error, can someone point what exactly am i missing, $ echo $SHELL /bin/bash $ printf " > SET serveroutput ON trimspool on feed off echo off > declare > p_val number; > d_val varchar2(10); > begin > SELECT... (1 Reply)
Discussion started by: kamauv234
1 Replies
Locale::Codes::Currency(3pm)				 Perl Programmers Reference Guide			      Locale::Codes::Currency(3pm)

NAME
Locale::Codes::Currency - standard codes for currency identification SYNOPSIS
use Locale::Codes::Currency; $curr = code2currency('usd'); # $curr gets 'US Dollar' $code = currency2code('Euro'); # $code gets 'eur' @codes = all_currency_codes(); @names = all_currency_names(); DESCRIPTION
The "Locale::Codes::Currency" module provides access to standard codes used for identifying currencies and funds, such as those defined in ISO 4217. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default ISO 4217 three-letter codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying currencies. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $curr = code2currency('usd','alpha'); $curr = code2currency('usd',LOCALE_CURR_ALPHA); The codesets currently supported are: alpha, LOCALE_CURR_ALPHA This is a set of three-letter (uppercase) codes from ISO 4217 such as EUR for Euro. Two of the codes specified by the standard (XTS which is reserved for testing purposes and XXX which is for transactions where no currency is involved) are omitted. This is the default code set. num, LOCALE_CURR_NUMERIC This is the set of three-digit numeric codes from ISO 4217. ROUTINES
code2currency ( CODE [,CODESET] ) currency2code ( NAME [,CODESET] ) currency_code2code ( CODE ,CODESET ,CODESET2 ) all_currency_codes ( [CODESET] ) all_currency_names ( [CODESET] ) Locale::Codes::Currency::rename_currency ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::Currency::add_currency ( CODE ,NAME [,CODESET] ) Locale::Codes::Currency::delete_currency ( CODE [,CODESET] ) Locale::Codes::Currency::add_currency_alias ( NAME ,NEW_NAME ) Locale::Codes::Currency::delete_currency_alias ( NAME ) Locale::Codes::Currency::rename_currency_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::Currency::add_currency_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::Currency::delete_currency_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.iso.org/iso/support/currency_codes_list-1.htm The ISO 4217 data. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 1997-2001 Canon Research Centre Europe (CRE). Copyright (c) 2001 Michael Hennecke Copyright (c) 2001-2010 Neil Bowers Copyright (c) 2010-2012 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.2 2012-10-11 Locale::Codes::Currency(3pm)
All times are GMT -4. The time now is 06:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy