Sponsored Content
Full Discussion: awk prints only last line
Top Forums Shell Programming and Scripting awk prints only last line Post 302969643 by pilnet101 on Friday 25th of March 2016 01:16:01 AM
Old 03-25-2016
As per the requirements, your current solution does not always round up the last field. The below solution will always round up the last field:

Code:
echo "${NEWTEXTS}" | awk '$NF=$NF==int($NF)?int($NF):int($NF)+1' OFS=, FS=,

This User Gave Thanks to pilnet101 For This Post:
 

10 More Discussions You Might Find Interesting

1. Solaris

Screen prints on SunOS 5.7

Is there an easy way to print what is on the screen? Running SunOS 5.7 and blackbox. (1 Reply)
Discussion started by: grayson
1 Replies

2. Shell Programming and Scripting

awk / grep / Prints all columns except the first one

I have the a file with the following data. File Content. 1249 snf06.3.0 sw version 1.1 code MD5 192F MD4 MD3 1248 sns06.3.0 sw version 1.1 code MD5 192F MD12 1250 sns06.3.0 sw version 1.1 code MD5 192F0\ MD8 1241 sns06.3.0 sw code MD5 19 1243 sn06.3.0 sw version 1.1 code MD5 19 12... (17 Replies)
Discussion started by: knijjar
17 Replies

3. Programming

Core image showing no prints

Hi All, I am facing a very peculiar problem with my applciation. The problem is that one of my process is making core very rarely.But when I am going to debug it,it is not showing any prints. The Make file is : g++ -g $(commonobjfiles) -o ipcl $(INCLUDES) -z muldefs -lpthread -lsocket... (0 Replies)
Discussion started by: unisuraj
0 Replies

4. Solaris

Epson ESC/P2 on solaris prints LD

I am hoping someone can help me with this little riddle. I have an oldish Epson ESC/P2 which I connected to a solaris10 box, with 2 queues, 1 with the solaris print filter so I can print from Solaris (works fine), and a second raw queue so that windows machines can print to it. The raw queue... (0 Replies)
Discussion started by: gdommett
0 Replies

5. Shell Programming and Scripting

awk system() prints extra 0 -- why?

Here's the command I'm running: # echo "hi" | awk '{etime = system("hostname") ; close("hostname") ; print etime""}' And here's the ouput: server.domain.tld 0 Why in the world is that second line, the one that's just "0", there? Many thanks in advance. (2 Replies)
Discussion started by: treesloth
2 Replies

6. Red Hat

hostname command prints nothing a null value

Hi , On my box everything works fine. But whenever I run command It returns nothing as you see @(none) too. Its very strange issue I have never noticed on any other system yet. Any one have any idea about this. Thank you (2 Replies)
Discussion started by: pratapsingh
2 Replies

7. Shell Programming and Scripting

prints some fields from different files into a line of new file

i have 3 files as below: i want to print 1st,2nd,5th and 10th filed of 1st to 5th lines from each files into a line of an output file, so the result would be: : {line1}(field 1 of line 1 from file 1)(field 2 of line 1 from file 1)(field 5 of line 1 from file 1)(field 10 of line 1 from file... (1 Reply)
Discussion started by: saeed.soltani
1 Replies

8. Shell Programming and Scripting

Need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line...

Hello, I need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line... An example of entries in the file would be: SRVXPAPI001 ERRO JUN24 07:28:34 1775 REASON= 0000, PROCID= #E506 #1065: TPCIPPR, INDEX= 003F ... (8 Replies)
Discussion started by: Ferocci
8 Replies

9. Shell Programming and Scripting

awk prints unwanted new lines

Hello, I need a little help with the following: I'm using AWK to read input from a comma-seperated value file, and only printing certain fields like so: awk -F "," '{print $1,$3,$6}' /list.csv | tail -1 Which outputs the following: server1 APPID OS I run into a problem... (8 Replies)
Discussion started by: LinuxRacr
8 Replies

10. Shell Programming and Scripting

Awk: BEGIN: prints nothing

My code fails to do anything if I've BEGIN block in it: Run the awk script as: awk -f ~/bin/sum_dupli_gene.awk make_gene_probe.txt #!/usr/bin/awk -f BEGIN { print ARGV #--loads of stuff } END{ #more stuff } (14 Replies)
Discussion started by: genome
14 Replies
ROUND(3)						   BSD Library Functions Manual 						  ROUND(3)

NAME
round, lround, llround -- round to integral value, regardless of rounding direction SYNOPSIS
#include <math.h> double round(double x); float roundf(float x); long int lround(double x); long int lroundf(float x); long long int llround(double x); long long int llroundf(float x); DESCRIPTION
The round() and roundf() functions return the integral value nearest to x rounding half-way cases away from zero, regardless of the current rounding direction. The lround() , lroundf() , llround() and llroundf() functions return the integral value nearest to x (rounding half-way cases away from zero, regardless of the current rounding direction) in the return formats specified. If the rounded value is outside the range of the return type, the numeric result is unspecified and the "invalid" floating-point exception is raised. A range error may occur if the magnitude of x is too large. SPECIAL VALUES
round(+-0) returns +-0. round(+-infinity) returns +-infinity. The round() functions may, but are not required to, raise the "inexact" floating-point exception for non-integer numeric arguments. The lround() and llround() functions need not raise the "inexact" floating-point exception for non-integer arguments that round to within the range of the return type. SEE ALSO
abs(3), fabs(3), ceil(3), floor(3), ieee(3), math(3), rint(3) STANDARDS
The round() , roundf() , lround() , lroundf() , llround() , and llroundf() functions conform to ISO/IEC 9899:1999(E). BSD
July 22, 2003 BSD
All times are GMT -4. The time now is 11:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy