Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
google site



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-29-2009
Registered User
 

Join Date: Mar 2009
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Insert text in datafile with uneven columns

Dear Unix Gurus,

I have a dataset consisting of a number of uneven columns. What I would like to do is fill up the missing rows with an arbitrary text of fixed value so that all columns now have an equal number of rows.

for example, in the sample datafile below...


Code:
1.0 1.3 0.25 2.2
2.0 1.1 0.25 3.1
3.0 1.2 0.25 2.1
4.0 1.4 0.25 0.1
5.0 1.5 0.25 0.13
8.0 1.7 0.25 0.16
11.5 4.3 0.25 0.1
-11.5 3.3 0.25 0.15
-12.5 4.3 0.25 0.1
-13.5 1.3 0.25 0.3
-14.5 1.4 0.25 0.2
-15.5 1.7 0.25 0.0
3.5 1.3 0.25 0.11
5.5 1.3 0.25 0.13
    5.3 0.25 0.15
    4.3 0.25 0.17
    2.3      0.11
    3.3      0.16
    1.1      
    1.4      
    1.8

I would like to fill all the blank rows with -999.99 so I have 4 columns of data, each with 21 rows of text.
Inserting an additional column is trivial enough but filling in the blank spaces of an existing column of data with an arbitrary number is beyond me at this time. I need help.....!!

cheers.
Sponsored Links
  #2  
Old 12-29-2009
vidyadhar85's Avatar
Moderator(The Tutor)
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,504
Thanks: 0
Thanked 0 Times in 0 Posts
how you wanna generate that arbitrary number??
can you elaborate bit more??
  #3  
Old 12-29-2009
Registered User
 

Join Date: Mar 2009
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Hi,

I want to insert a pre-defined number, i.e. in this case "-999.99", into all blank rows.

The reason for this is that I want to use the datafile to generate histograms - one for each data column. Problem is the histograms must all have the same number of entries or else my code fails. So I need to insert an arbitrary high number say, 999 or -999 to fill up the blank rows. On generating the histograms I can then select the data I'm interested in using cuts.

Cheers
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Reversing numbers in a datafile of rows and columns mattings Shell Programming and Scripting 16 04-17-2009 08:03 AM
Need to insert new text and change existing text in a file using SED iamgeethuj Shell Programming and Scripting 4 11-25-2008 02:59 AM
How to insert some constant text at beginig of each line within a text file. Muhammad Afzal Shell Programming and Scripting 4 10-30-2008 10:01 PM
How to insert dummy columns smolgara AIX 2 04-19-2008 09:05 AM
Combine a datafile with Master datafile, emergent! onthetopo Shell Programming and Scripting 6 05-12-2007 06:36 AM



All times are GMT -4. The time now is 07:47 AM.