Computing.Net > Forums > Unix > Separating the Columns based on ColumnSize

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Separating the Columns based on ColumnSize

Reply to Message Icon

Name: SeenuGuddu
Date: October 28, 2009 at 23:15:14 Pacific
OS: Windows XP
Subcategory: General
Comment:

Hi Gurus,

i had a Table with the columns

col1 Decimal(3),
col2 Decimal(2),
col3 String(1),
col4_blank1 String(2),
col5_blank2 String(10),
col6 String(3);


the Data(Records) of the Table in flat file is

89522D 085NOVOLIN BRAND 888888ALL OTHER

i want to display the output by separating the columns with ~ based on the column size is 3 of col1 Decimal(3) and col2 having the size 2...

895~22~D ~ ~085~NOVOLIN~

Thanks in Advance



Sponsored Link
Ads by Google

Response Number 1
Name: tvc
Date: October 31, 2009 at 06:38:40 Pacific
Reply:

Is the table relevant for the question, or do you want a solution starting from a flat file ?


0

Response Number 2
Name: SeenuGuddu
Date: November 12, 2009 at 03:24:38 Pacific
Reply:

Yes ..solution starting from a flat file


0

Response Number 3
Name: tvc
Date: November 14, 2009 at 07:08:42 Pacific
Reply:

echo xxx | awk '{ print substr($1,1,3) "~" substr($2,1,2) "~" $3 }'

AWK by defaults treats all inputs as text


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Separating the Columns based on ColumnSize

ftp using mget based on time stamp www.computing.net/answers/unix/ftp-using-mget-based-on-time-stamp-/6625.html

Sorting lines based on strict rule www.computing.net/answers/unix/sorting-lines-based-on-strict-rule/8382.html

renaming files based on date arguments www.computing.net/answers/unix/renaming-files-based-on-date-arguments/2499.html