Sponsored Content
Full Discussion: awk prints only last line
Top Forums Shell Programming and Scripting awk prints only last line Post 302969641 by SkySmart on Friday 25th of March 2016 12:24:15 AM
Old 03-25-2016
Quote:
Originally Posted by RavinderSingh13
Hello SkySmart,

Could you please try following and let me know if this helps.
Code:
echo "${NEWTEXTS}" | awk -F, '{a=$1; b=$2; c=$3; d=$4; e=$5; f=$6 } {printf("%s,%s,%s,%s,%s,%0.f\n", a,b,c,d,e,f)}'

Off course culprit there was END in your code. Also you could go through the manual page of awk by doing man awk, as follows mentioned in that for END.

Hope this helps.

Thanks,
R. Singh

Your suggestion works!

Thank you!
 

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
IGAWK(1)							 Utility Commands							  IGAWK(1)

NAME
igawk - gawk with include files SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ... igawk [ all gawk options ] [ -- ] program-text file ... DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1). AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like @include getopt.awk in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path. OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports. EXAMPLES
cat << EOF > test.awk @include getopt.awk BEGIN { while (getopt(ARGC, ARGV, "am:q") != -1) ... } EOF igawk -f test.awk SEE ALSO
gawk(1) Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995. AUTHOR
Arnold Robbins (arnold@skeeve.com). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWgawk | +--------------------+-----------------+ |Interface Stability | Volatile | +--------------------+-----------------+ NOTES
Source for gawk is available on http://opensolaris.org. Free Software Foundation Nov 3 1999 IGAWK(1)
All times are GMT -4. The time now is 01:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy