![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ksh scripting help | praveenbvarrier | Shell Programming and Scripting | 1 | 04-15-2008 10:19 AM |
| sql scripting help | sam786 | Shell Programming and Scripting | 3 | 12-10-2007 12:31 PM |
| difference between AIX shell scripting and Unix shell scripting. | haroonec | Shell Programming and Scripting | 2 | 04-12-2006 08:12 AM |
| scripting guru's pls help me with scripting on AIX | thatiprashant | Shell Programming and Scripting | 1 | 01-20-2006 07:58 PM |
| Scripting? | woofie | What's on Your Mind? | 1 | 03-09-2005 07:03 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
The output from this awk command is
0508 0601 LVTS4687 58 1ltreb_shu1l110 shu1l110 0509 0108 LVTS4687 58 1ltreb_shu1l110 shu1l110 0509 0108 LVTS4687 58 1ltreb_shu1l110 shu1l110 0509 0108 LVTS4687 58 1ltreb_shu1l110 shu1l110 0508 2206 LVTS5035 98 1sy_unix_live_dmz_duplex_15_35 srublae03-mgt 0508 2206 LVTS5035 98 1sy_unix_live_dmz_duplex_15_35 srublae03-mgt 0508 2206 LVTS5035 98 1sy_unix_live_dmz_duplex_15_35 srublae03-mgt 0508 2206 LVTS5430 98 1 0508 2206 LVTS5430 98 1 0508 2206 LVTS5430 98 1 0508 2206 LVTS5431 98 1lmurb_shu1l282 shu1l282-sy 0508 2206 LVTS5431 98 1lmurb_shu1l282 shu1l282-sy 0508 2206 LVTS5431 98 1lmurb_shu1l282 shu1l282-sy 0506 0920 LVTS5750 41 3nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT 0506 0920 LVTS5750 41 3nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT 0506 0920 LVTS5750 41 3nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT 0506 0920 LVTS5750 41 3nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT 0506 0920 LVTS5750 41 3nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT 0506 0920 LVTS5750 41 3nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT Which is almost there apart from there being no space between parm5 and 6 and also parm 4 is reduced to the last 2 digits. Apologies for my ignorance on this but I have never used "awk" before. The file should look like this 0508 0601 LVTS4687 58 1 ltreb_shu1l110 shu1l110 0509 0108 LVTS4687 58 1 ltreb_shu1l110 shu1l110 0509 0108 LVTS4687 58 1 ltreb_shu1l110 shu1l110 0509 0108 LVTS4687 58 1 ltreb_shu1l110 shu1l110 0508 2206 LVTS5035 98 1 sy_unix_live_dmz_duplex_15_35 srublae03-mgt 0508 2206 LVTS5035 98 1 sy_unix_live_dmz_duplex_15_35 srublae03-mgt 0508 2206 LVTS5035 98 1 sy_unix_live_dmz_duplex_15_35 srublae03-mgt 0508 2206 LVTS5430 98 1 0508 2206 LVTS5430 98 1 0508 2206 LVTS5430 98 1 0508 2206 LVTS5431 98 1 lmurb_shu1l282 shu1l282-sy 0508 2206 LVTS5431 98 1 lmurb_shu1l282 shu1l282-sy 0508 2206 LVTS5431 98 1 lmurb_shu1l282 shu1l282-sy 0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT 0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT 0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT 0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT 0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT 0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT Is it possible to format the file so each parm starts in a specific column for example Parm1 in Col1 Parm2 in Col6 Parm3 in Col12 Parm4 in Col22 Parm5 in Col27 Parm6 in Col30 Parm7 in Col65 |
|
||||
|
That sounds like a simple printf specifier.
Code:
awk whatever ... |
awk '{ printf ("%5s%6s%9s%5s%3s%35s%s\n", $1, $2, $3, $4, $5, $6, $7) }'
I don't see anything which would be reducing $6 to just two characters. |
|
||||
|
The original file2 had the following
0508 2206 LVTS5431 98 1 0506 0920 LVTS5750 141 3 but the output to file3 shows 0506 0920 LVTS5750 41 3nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT where the 141 is truncated to 41 the final output I would like to see so that each parm is alligened in the specific columns Starting in column 1 6 12 22 27 30 65 0508 0601 LVTS4687 58 1 ltreb_shu1l110 shu1l110 Last edited by Northerner; 05-14-2008 at 08:51 AM.. |
|
||||
|
Whatever is causing that is not happening here, and it's unlear why it would be caused by Radoulov's script; it doesn't alter $6. Might your input file have been corrupted at some point?
|
|
||||
|
It's not showing as aligned any particular way here. Maybe if you post an example with code tags we can see better what you mean. (This regular HTML edit box will squeeze all spaces down to one.)
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| solaris |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|