Sponsored Content
Top Forums Shell Programming and Scripting Format output using awk in script. Post 302157970 by Perderabo on Sunday 13th of January 2008 09:10:18 PM
Old 01-13-2008
Works for me...

Code:
$ cat data
Header1 .....xsdfsfa...adfa......
Header2 ....afefas .aefaefsdf...
-------------------------------------------------

A1 as_p:xxxxxxxxx as_p:yyyyyyyyy as_p:zzzzzzzzz
A2 as_p:dskfjsjfsd as_p:sdfafjlaflkd


Header1 .....xsdfsfa...adfa......
Header2 ....afefas .aefaefsdf...
-------------------------------------------------

B1 as_p:xxxxxxxxx as_p:yyyyyyyyy as_p:zzzzzzzzz
B2 as_p:dskfjsjfsd as_p:sdfafjlaflkd
B3 as_p:dsoiugtoi as_p:woiuiosgsd as_pwuewuu

Header1 .....xsdfsfa...adfa......
Header2 ....afefas .aefaefsdf...
-------------------------------------------------

C1 as_p:xxxxxxxxx as_p:yyyyyyyyy as_p:zzzzzzzzz
C2 as_p:dskfjsjfsd as_p:sdfafjlaflkd
C3
$
$
$
$
$ awk '/as_p/ { gsub(" ", "\n")}{print} ' data
Header1 .....xsdfsfa...adfa......
Header2 ....afefas .aefaefsdf...
-------------------------------------------------

A1
as_p:xxxxxxxxx
as_p:yyyyyyyyy
as_p:zzzzzzzzz

A2
as_p:dskfjsjfsd
as_p:sdfafjlaflkd


Header1 .....xsdfsfa...adfa......
Header2 ....afefas .aefaefsdf...
-------------------------------------------------

B1
as_p:xxxxxxxxx
as_p:yyyyyyyyy
as_p:zzzzzzzzz

B2
as_p:dskfjsjfsd
as_p:sdfafjlaflkd
B3
as_p:dsoiugtoi
as_p:woiuiosgsd
as_pwuewuu

Header1 .....xsdfsfa...adfa......
Header2 ....afefas .aefaefsdf...
-------------------------------------------------

C1
as_p:xxxxxxxxx
as_p:yyyyyyyyy
as_p:zzzzzzzzz

C2
as_p:dskfjsjfsd
as_p:sdfafjlaflkd
C3
$

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Output in a particular format using AWK

Hi All, I am trying to check if if column 5 is greater than 90. If greater it will print the term in column 6, else if all are within limit, then it will output "Size is within limit". I can't seem to do that with the below code. The output should only be 1 statement of "Size is within the... (4 Replies)
Discussion started by: Raynon
4 Replies

2. Shell Programming and Scripting

[need help] output format from awk

hi all, i have a problem with my nawk command output below is the description : nawk $12 == "00008001" { cnt++;cs_cd } END {for(cd in cs_cd) print cd, cs_cd } 2007020814.TDR output : 133 123 desire output: 133,123,.... please advices thank you so much (6 Replies)
Discussion started by: bucci
6 Replies

3. Shell Programming and Scripting

scripting/awk help : awk sum output is not comming in regular format. Pls advise.

Hi Experts, I am adding a column of numbers with awk , however not getting correct output: # awk '{sum+=$1} END {print sum}' datafile 2.15291e+06 How can I getthe output like : 2152910 Thank you.. # awk '{sum+=$1} END {print sum}' datafile 2.15079e+06 (3 Replies)
Discussion started by: rveri
3 Replies

4. Shell Programming and Scripting

awk - format output

Input file1 zone: BAU_SERVER1 C0:50:76:01:C6:20:00:12; 50:06:01:69:3B:20:14:8B; 50:06:01:60:3B:20:14:8B zone: BAU_SERVER2 C0:50:76:01:C6:20:00:08; 50:06:01:69:3B:20:14:8B; 50:06:01:60:3B:20:14:8B zone: ... (4 Replies)
Discussion started by: greycells
4 Replies

5. Shell Programming and Scripting

awk to format an output

awk experts, I have in put file with time stamp followed by "," separated data. same patern continues. The output need time stamp in first columns and data total in 2nd columns. Input file T 9:15 d0,1,3,3 d1,2,1,1 d2,3,1,5 e1,1,1,1 T 9:30 d0,1,1,1 d1,2,3,2 d3,1,2,1... (10 Replies)
Discussion started by: arv_cds
10 Replies

6. UNIX for Dummies Questions & Answers

after awk-> format output

hi i have a awk command with several querys.... awk 'FS="|""; print $4, $5, $6...etc.... $4 gives me the date 20120304 $5 is timestamp 101023 I want to format these in 2012.03.04 or 2012/03/04 10:10:23 but have no idea, if this is possible with format-parameters in the awk... (2 Replies)
Discussion started by: Jazzmatazz
2 Replies

7. Shell Programming and Scripting

Format output using awk

Hello all , need help with this ... Input File DEV % POOL 0CB4 FBA 2211300 81792 4 IE RAID-5(3+1) R5_EFD100_1 - - 1805376 82 IF RAID-1 M2_FC300_1 - ... (4 Replies)
Discussion started by: greycells
4 Replies

8. Shell Programming and Scripting

Adjusting my awk output format

I've been diving into awk but still learning how to use it for text formatting. Below you can see my results are separated by a comma. Can somebody show me how to separate by TAB as well? An explanation would be appreciated as I did not comprehend the answer in the man pages and would like to gain... (1 Reply)
Discussion started by: sudo
1 Replies

9. Shell Programming and Scripting

awk Script to format output

Hi all, I'm fairly new to this and learning along the way, so bare with me... I'm trying to format the output from a script to be more read-friendly. The output contains more servers and more processes but for as example it will do: Server: Test1 ... (4 Replies)
Discussion started by: Bobsonm
4 Replies

10. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

Hi , i am generating some data by firing sql query with connecting to the database by my solaris box. The below one should be the header line of my excel ,here its coming in separate row. TO_CHAR(C. CURR_EMP_NO ---------- --------------- LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies
GIFTRANS(1)						      General Commands Manual						       GIFTRANS(1)

NAME
giftrans - transform gif from gif87 to gif89, making one color transparent SYNOPSIS
giftrans [options] [-o filename] filename DESCRIPTION
giftrans converts any GIF file into a GIF89a. Allows for setting the transparent or background color, changing colors, adding or removing comments. Also code to analyze GIF contents. OPTIONS
-h Print short help on stdout. -t Specify the transparent color -T Index of the transparent color is the background color index -B Specify the transparent color's new value -b Specify the background color -g Change a color in the global color table -c Add a comment -C Remove old comment -l Only list the color table -L Verbose output of GIFs contents -V Verbose output while converting -o Redirect stdout to a file -e Redirect stderr to a file Colors may be specified as index, as rgb.txt entry or in the #rrggbb form. Of course, beware that shells will often consider the # charac- ter to start a comment and so you may have to escape it! EXAMPLE
To convert the white background of a gif file to transparent, use giftrans -t #ffffff file.gif > transparentfile.gif BUGS
This program has been tested on a HP9000/720 with HP-UX A.08.07 In this environment, neither lint -u nor gcc -Wall produce any messages. If you encounter any errors or need to make any changes to port it to another platform, please contact me. Known bugs: -B flag won't work if there's an Extension between the Global Color Table and the Image Descriptor (or Graphic Control Extension). If -V has been specified, a Warning Message will be displayed. Will be fixed in 2.0 Always outputs GIF89a. Shouldn't do this if version is newer. -D option may output changed data instead of original data, use with caution, best only with then -L option. COPYRIGHT
Copyright (c) 24.2.94 by Andreas Ley <ley@rz.uni-karlsruhe.de> Permission to use, copy, modify, and distribute this software for any purpose and without fee is hereby granted, provided that the above copyright notice appears in all copies. This software is provided "as is" and without any express or implied warranties. VERSION HISTORY
Version 1.11 - 21.7.94 Moved Plain Text Extension to the Extensions section where it belongs Accept Unknown Extension Labels Incorporated MS-DOS port by enzo@hk.net (Enzo Michelangeli) Added -o and -e options to redirect stdout and stderr Added -D debug flag Version 1.10.2 - 22.6.94 Support for -DRGBTXT flag Version 1.10.1 - 21.6.94 Different rgb.txt file FreeBSD/386BSD Version 1.10 - 19.6.94 Added option to change a color in the global color table Added option to change the color for the transparent color index Version 1.9.1 - 7.6.94 Different rgb.txt files for X11 and Open Windows Version 1.9 - 1.6.94 Fixed a bug which caused color names to be rejected. Version 1.8 - 30.5.94 Accept #rrggbb style arguments. Do nothing if rgb-color not found in GIF. Version 1.7 - 16.5.94 Added -l option to only list the color table. Added -L option for verbose output without creating a gif. Added -b option to change the background color index. Display all matching color names for color table entries. Fixed a bug which caused bad color names if rgb.txt starts with whitespace. Doesn't use strdup anymore. Fixed =& bug on dec machines. Version 1.6 - 5.4.94 Added color names recognition. Version 1.5 - 15.3.94 Added basic verbose output to analyze GIFs. Version 1.4 - 8.3.94 Fixed off-by-one bug in Local Color table code. Added option to add or remove a comment. Transparency is no longer the default. This man file made 9.8 from documentation in the program source code by Kai Nordlund (knordlun@fltxa.helsinki.fi). THANKS
Thanx for bug reports, ideas and fixes to patricka@cs.kun.nl (Patrick Atoon) wes@msc.edu (Wes Barris) pmfitzge@ingr.com (Patrick M. Fitzgerald) hoesel@chem.rug.nl (frans van hoesel) boardman@jerry.sal.wisc.edu (Dan Boardman) krweiss@chip.ucdavis.edu (Ken Weiss) chuck@trantor.harris-atd.com (Chuck Musciano) heycke@camis.stanford.edu (Torsten Heycke) claw@spacsun.rice.edu (Colin Law) jwalker@eos.ncsu.edu (Joseph C. Walker) Bjorn.Borud@alkymi.unit.no (Bjorn Borud) Christopher.Vance@adfa.oz.au (CJS Vance) pederl@norway.hp.com (Peder Langlo) I.Rutson@bradford.ac.uk (Ian Rutson) Nicolas.Pioch@enst.fr (Nicolas Pioch) john@charles.CS.UNLV.EDU (John Kilburg) enzo@hk.net (Enzo Michelangeli) SEE ALSO
xv(1), giftoppm(1), ppmtogif(1) GIFTRANS(1)
All times are GMT -4. The time now is 09:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy