typeset and values returned from awk output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting typeset and values returned from awk output
# 1  
Old 12-09-2005
Network typeset and values returned from awk output

Somebody can please give a highlight on this. The problem shows only on Linux(Redhat) not any other unix flavors
Smilie
Linux :
$unset m
$m=`find . -newer rman_padev_20051206195000.out -name "*L0.rman" -exec ls -l {} \; | awk '{ s+=$5 } END{printf("%.0f", s)}'`
$echo $m
7425089536
$typeset -i i
$((i=$m*1)); echo $i
-1164845056

$unset m
$typeset -i m
$m=`find . -newer rman_padev_20051206195000.out -name "*L0.rman" -exec ls -l {} \; | awk '{ s+=$5 } END{printf("%.0f", s)}'`
$echo $m
-1164845056

I tried to use '%d' or '%i' in awk print format. But that return scientific (exponential) output in linux ksh.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading output returned to OS from java program.

I am writing one shell script in which there is one Java program call. I want to stop execution of shell script ahead of java program if the java program returns 1 . How to read that value of java program from OS ? (3 Replies)
Discussion started by: ParthThakkar
3 Replies

2. Shell Programming and Scripting

Perl: How to avoid warnings for superfluous values returned?

Hi all, a question for the Perl knowledgeable: I have use warnings; enabled. I use something like: ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); In the further code I only work with some of the returned variables, as the others I have no need for. Though the... (1 Reply)
Discussion started by: zaxxon
1 Replies

3. UNIX for Dummies Questions & Answers

How to compare to values returned from sql in shell scripting?

hey i am using this code to connect to sql , store the value in variable and then compare it with another variable after some time by executing the same query but the desired result is not coming #!/bin/bash val=$(sqlplus -s rte/rted2@rel76d2 <<ENDOFSQL set heading off set feedback off... (11 Replies)
Discussion started by: ramsavi
11 Replies

4. Shell Programming and Scripting

Capture query returned values in file.

Hi All, I am connecting to Oracle DB from UNIX script. Want to capture all dates between start date and end date and store them in file. Once this is done, want to read dates one by one. How to achive this in UNIX and Oracle? Please let me know if you have any idea on the same. Thanks and... (4 Replies)
Discussion started by: Nagaraja Akkiva
4 Replies

5. Shell Programming and Scripting

Adding values returned through foreach

Hi Folks I wanted to do something like this : Go through all the top_level_dirs inside a particular dir. Grep a particular string in the files in each of those dirs. Count the occurence of that string in that file Keep adding these (wc) values so that I can know the total occurences of that... (1 Reply)
Discussion started by: abcdino
1 Replies

6. Shell Programming and Scripting

How to grep/awk/egrep two values for given output?

Dear Friends, I have a command which can result following output. Packet is: /var/adm/yyyy/pkt6043 Intended for network : /vob/repo I would like to retrive pkt6043 and /vob/repo using single command. Blue color test will be always contstant and red color text will be dynamic ... (2 Replies)
Discussion started by: baluchen
2 Replies

7. UNIX for Dummies Questions & Answers

Assigning the output of a command to a variable, where there may be >1 line returned?

Hello I am using unix CLI commands for the Synergy CM software. The command basically searches for a folder ID and returns the names of the projects the folder sits in. The result is assigned to a variable: FIND_USE=`ccm folder -fu -u -f "%name"-"%version" ${FOLDER_ID}` When the command... (6 Replies)
Discussion started by: Glyn_Mo
6 Replies

8. Shell Programming and Scripting

grep, awk, typeset in a shell script..

For e.g I have a file named "relation" which has three coloums i.e JOHN MARY JACK PETE ALISIA JONNY TONY JACKIE VICTOR If I do grep -w 'JOHN' relation | awk '{print""$1" is husband of "$2" & father of "$3""}' It gives out JOHN i husband of MARY & father of JACK (which is desired... (7 Replies)
Discussion started by: nick_25
7 Replies

9. Shell Programming and Scripting

assign values from awk output - help

Dear All, I have a command which gives the number of fields of each line of a comma-separated file. sthng like this : cat QDB_20071126_002.bad | awk -F"," '{ print NF }' I need to assign the first output and the last output of the above command to variables in a script. Need help to do... (4 Replies)
Discussion started by: KrishnaSaran
4 Replies

10. Shell Programming and Scripting

HTTP Query Request & Parsing returned XML output

I have a PERL script from which I need to make a HTTP request to Web Servlet (Essentially a URL with variables and values like &Variable1=AAAAAA&Variable2=BBBBBBBBB&Variable3=CCCCCCC). The Web servlet returns an XML result which needs to be parsed for the contents of the result within the program.... (15 Replies)
Discussion started by: jerardfjay
15 Replies
Login or Register to Ask a Question
READONLY(1P)						     POSIX Programmer's Manual						      READONLY(1P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
readonly -- set the readonly attribute for variables SYNOPSIS
readonly name[=word]... readonly -p DESCRIPTION
The variables whose names are specified shall be given the readonly attribute. The values of variables with the readonly attribute cannot be changed by subsequent assignment, nor can those variables be unset by the unset utility. If the name of a variable is followed by =word, then the value of that variable shall be set to word. The readonly special built-in shall support the Base Definitions volume of POSIX.1-2008, Section 12.2, Utility Syntax Guidelines. When -p is specified, readonly writes to the standard output the names and values of all read-only variables, in the following format: "readonly %s=%s ", <name>, <value> if name is set, and "readonly %s ", <name> if name is unset. The shell shall format the output, including the proper use of quoting, so that it is suitable for reinput to the shell as commands that achieve the same value and readonly attribute-setting results in a shell execution environment in which: 1. Variables with values at the time they were output do not have the readonly attribute set. 2. Variables that were unset at the time they were output do not have a value at the time at which the saved output is reinput to the shell. When no arguments are given, the results are unspecified. OPTIONS
See the DESCRIPTION. OPERANDS
See the DESCRIPTION. STDIN
Not used. INPUT FILES
None. ENVIRONMENT VARIABLES
None. ASYNCHRONOUS EVENTS
Default. STDOUT
See the DESCRIPTION. STDERR
The standard error shall be used only for diagnostic messages. OUTPUT FILES
None. EXTENDED DESCRIPTION
None. EXIT STATUS
Zero. CONSEQUENCES OF ERRORS
Default. The following sections are informative. APPLICATION USAGE
None. EXAMPLES
readonly HOME PWD RATIONALE
Some historical shells preserve the readonly attribute across separate invocations. This volume of POSIX.1-2008 allows this behavior, but does not require it. The -p option allows portable access to the values that can be saved and then later restored using, for example, a dot script. Also see the RATIONALE for export for a description of the no-argument and -p output cases and a related example. Read-only functions were considered, but they were omitted as not being historical practice or particularly useful. Furthermore, functions must not be read-only across invocations to preclude ``spoofing'' (spoofing is the term for the practice of creating a program that acts like a well-known utility with the intent of subverting the real intent of the user) of administrative or security-relevant (or security- conscious) shell scripts. FUTURE DIRECTIONS
None. SEE ALSO
Section 2.14, Special Built-In Utilities The Base Definitions volume of POSIX.1-2008, Section 12.2, Utility Syntax Guidelines COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2013 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, Copyright (C) 2013 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. (This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Stan- dard is the referee document. The original Standard can be obtained online at http://www.unix.org/online.html . Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . IEEE
/The Open Group 2013 READONLY(1P)