![]() |
|
|
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 |
| Add non-integers using ksh | 2dumb | Shell Programming and Scripting | 18 | 04-13-2009 01:28 AM |
| problem with AWK and floats below 0 | JCastro | Shell Programming and Scripting | 4 | 03-17-2009 10:06 AM |
| Using write() with integers in C | h@run | High Level Programming | 2 | 02-11-2008 02:46 PM |
| integers in the if statement | Deanne | Shell Programming and Scripting | 5 | 01-22-2008 05:14 AM |
| Multiplying Floats/Decimals | rleebife | Shell Programming and Scripting | 10 | 08-02-2007 06:22 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
integers, floats and text
I am using gawk in a dos shell in windows xp and want to read a datafile and reformat it.
The datafile consists of columns of integers, floating point numbers and text strings. Each column is a fixed width and each column contains the same data type, eg all integers, all text. I am looking for a way to read each field ($1,$2 etc) and determine if it is integer, floating point or text. I then want to write it to another file in a new format, somthing like: if ($1 is integer) printf %5.0f",$1 elseif ($1 is floating point) printf "%5.2f", $1 elseif ($1 is text) printf "%5s",$1 All I need is what goes in the brackets - if that is possible. Thanks |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|