Sponsored Content
Full Discussion: awk script formatting
Top Forums Shell Programming and Scripting awk script formatting Post 302261637 by King Nothing on Tuesday 25th of November 2008 09:13:57 AM
Old 11-25-2008
awk script formatting

Hello,
I have got the following kine in my script
awk '{printf("%s,", $0);next}{printf("%s", $0)}' ORS="," a.txt > b.out

The contents of b looks somewaht like this:
QUEUE(QUEUE1.Q),CURDEPTH(0),QUEUE(QUEUE2.Q),CURDEPTH(0),QUEUE(QUEUE3.Q),CURDEPTH(0)
But my desired output is :
QUEUE(QUEUE1.Q),CURDEPTH(0),
QUEUE(QUEUE2.Q),CURDEPTH(0),
QUEUE(QUEUE3.Q),CURDEPTH(0)
Not good with this awk thing.
Any idea folks.
Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Formatting using awk

Let's say I write a simple script that contains the following: date | awk '{print $1}' date | awk '{print $2}' Of course, when I run the script the output will look similar to: Tue Mar What if I want my ouput to be on one line as follows: Tue Mar What changes would I need to... (2 Replies)
Discussion started by: cdunavent
2 Replies

2. UNIX for Advanced & Expert Users

formatting textfile inside ksh script using awk not working

I cannot seem to get this text file to format. Its as if the awk statement is being treated as a simple cat command. I manned awk and it was very confusing. I viewed previous posts on this board and I got the same results as with the the awk command statement shown here. Please help. ... (6 Replies)
Discussion started by: tekline
6 Replies

3. Homework & Coursework Questions

Loosing formatting when echoing an awk script

1. The problem statement, all variables and given/known data: When I echo out the output of my awk script I loose the formatting that I set in my awk script (it should be in a table format). 2. Relevant commands, code, scripts, algorithms: 3. The attempts at a solution (include all... (2 Replies)
Discussion started by: ROFL
2 Replies

4. Shell Programming and Scripting

AWK formatting help.

Dear all I require help with AWK regarding this situation Input is : fn1 12345 fn1 23456 fn3 231513 fn1 22325 fn3 123125 Desired output is fn1 12345 23456 22325 fn3 231513 123125 (5 Replies)
Discussion started by: Peasant
5 Replies

5. Shell Programming and Scripting

AWK printing formatting help please

Hi all, Below is my testfile: COST,31-MAR-2011 01:01:04,31-MAR-2011 11:22:12,622 COST,21-MAR-2011 22:00:20,22-MAR-2011 11:07:23,788 FARE,23-MAR-2011 22:00:22,24-MAR-2011 10:10:46,731 FARE,02-MAR-2011 14:01:50,03-MAR-2011 08:30:54,1110 I need to append a number, for example 700, to the... (2 Replies)
Discussion started by: newbie_01
2 Replies

6. Shell Programming and Scripting

formatting awk

when i try this awk its giving out put as below. awk '!(/^$/||/--/||/selected/||/^ *$/){print $1}' tmp.txt output ===== 1 2010-08-03-12.31.26.126000 how excluede the 1st line ? i mean i want output only 2nd line i.e 2010-08-03-12.31.26.126000; (5 Replies)
Discussion started by: rocking77
5 Replies

7. Shell Programming and Scripting

Formatting a report using awk

Our vendor produces a report that I would like to format in a particular way. Here is the sample output from their report: # AA.INDEX 2 11 2 239 52 (7,2) 07 MAY 11 203.1 55 # ACCOUNT 2 89561 2 ... (4 Replies)
Discussion started by: thaller
4 Replies

8. UNIX for Dummies Questions & Answers

awk formatting

Hi all, I'm writing a simple awk code: awk 'BEGIN {FS="|"};{print "Type\tNumber\ttypes\tTotal";};{print $1, "\t", $2, "\t", $3, "\t", $4, "\t";}' db_query.txt it gives me the result: Type Number types Total XXX 498.0 5100.0 5274.661 Type Number types Total... (7 Replies)
Discussion started by: messi777
7 Replies

9. Shell Programming and Scripting

AWK/Shell script for formatting data in a file

Hi All, Need an urgent help to convert a unix file in to a particular format: **source file:** 1111111 2d2f2h2 3dfgsd3 ........... 1111111 <-- repeats in every nth line. remaining all lines will be different 123ss41 432ff45 ........... 1111111 <-- repetition qwe1234 123weq3... (1 Reply)
Discussion started by: rajivnairfis
1 Replies

10. Shell Programming and Scripting

awk Script Output in Outlook Formatting Issue

When i execute the below shell script with 2 different Input files, for one of the data files (datafile1) my email message body in the outlook messes up and every thing comes up in one line. May i please know what i am doing wrong here or how to fix this? The only difference in data files is one is... (1 Reply)
Discussion started by: Ariean
1 Replies
CHECKPC(8)							  checkpc command							CHECKPC(8)

NAME
checkpc - check out the printcap database SYNOPSIS
checkpc [ -aflprsV ] [ -Aage[DHMS] ] [ -Ddebugflags ] [ -Pprinter ] [ -t size[kM] ] DESCRIPTION
Checkpc is used to check for the existence and correct permissions of entries in the printcap database. It is useful when installing a new printcap database and cleaning up existing printer spoolers. -a Do not create accounting files (:af). -f The fix flag will cause the checkpc program create and fix various files and permissions. It does this in a simple minded manner, and the program may have to be run several times until all permissions are correct. It also reports in extremely verbose details its actions. -l Do not create log files (:lf). -p Print verbose printcap information. Useful if interested in the printcap values. -r remove junk or job files older than the age set by -A. You must set the age to a non-zero value otherwise no files are removed. -s Do not create filter status files (:ps). -A Age[DHMS] Report junk or job files older than age. The age time can have a suffix days (D) hours (H), minutes (M), or seconds (S); default is days. -D debugflags Run the program with debugging flags. See the LPRng HOWTO for details of the flags actions. -V Verbose mode. -P printer Process only the specified print queue. -t size[kM] Truncate log files (:lf) to the specified size in Kbytes or Mbytes (default is Mbytes). -T serial-line set process name and start feature test ANNOYING FEATURES
If the -f(fix) option is specified and you do not run this as root, it will complain, but attempt to carry out the operations. This will lead to a large number of failures reports if the ownership and/or permissions are incorrect. FILES
The files used by LPRng are set by values in the printer configuration file and by configuration options. The following are a commonly used set of default values. /etc/lprng/lpd.conf LPRng configuration file ${HOME}/.printcap user printer description file /etc/printcap printer description file /etc/lprng/lpd.perms permissions /var/run/lprng/lpd lock file for queue control /var/spool/lpd spool directories /var/spool/lpd/QUEUE/control queue control /var/spool/lpd/QUEUE/log trace or debug log file /var/spool/lpd/QUEUE/acct accounting file /var/spool/lpd/QUEUE/status status file SEE ALSO
lpd.conf(5), lpc(8), lpd(8), lpr(1), lpq(1), lprm(1), printcap(5), lpd.perms(5), pr(1), lprng_certs(1), lprng_index_certs(1). AUTHOR
Patrick Powell <papowell@lprng.com>. DIAGNOSTICS
Most of the diagnostics are self explanatory. If you are puzzled over the exact cause of failure, set the debugging level on (-D5) and run again. The debugging information will help you to pinpoint the exact cause of failure. HISTORY
LPRng is a enhanced printer spooler system with functionality similar to the Berkeley LPR software. The LPRng developer mailing list is lprng-devel@lists.sourceforge.net; subscribe by visiting https://lists.sourceforge.net/lists/listinfo/lprng-devel or sending mail to lprng- request@lists.sourceforge.net with the word subscribe in the body. The software is available via http://lprng.sourceforge.net LPRng 2007-02-22 CHECKPC(8)
All times are GMT -4. The time now is 04:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy