Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Spliting a line after 255 characters. Post 302996739 by RudiC on Monday 1st of May 2017 04:26:12 PM
Old 05-01-2017
Try
Code:
awk -F, '
        {i = 0
         MX = split ($2, T, "]") - 2
         while (i <= MX)        {OUT = $1 OFS SQ
                                 while ((length (OUT T[i+1]) < 255) && (i <= MX)) OUT = OUT T[++i] "]"
                                 sub (SQ "( |" SQ ")", SQ, OUT)
                                 print  OUT SQ ");"
                                }
        }
' OFS="," SQ="'" file
call sp_rebuildindex('aaa.aaa','column [CUST_ACCT_ID] column [CHANNEL_TYPE_CD1] column [CHANNEL_TYPE_CD2] column [ORD_PRFL_CD] column [MCK_KU_TERM_RSN_CD] column [CUST_STAT_XMPT_CD] column [DLVRY_FEE_CD] column [MCK_KU_DEA_ELIG_CD1]');
call sp_rebuildindex('aaa.aaa','column [MCK_KU_DEA_ELIG_CD2] column [MCK_KU_DEA_ELIG_CD3] column [MCK_KU_DEA_ELIG_CD4] column [MCK_KU_DEA_ELIG_CD5] column [MCK_KU_DEA_ELIG_CD6] column [MCK_KU_DEA_ELIG_CD7] column [MCK_KU_DEA_ELIG_CD8]');
call sp_rebuildindex('aaa.aaa','column [MCK_KU_PVT_LBL_CD] column [ORDR_CONFO_CD] column [POG_OPTN_CD] column [POG_SIGNAGE_CD] column [OTC_RETL_PRC_HIER_CD] column [RX_RETL_PRC_HIER_CD] column [MCK_KU_CONSOL_TYP_CD] column [MCK_KU_MKTG_OPTN_CD]');
call sp_rebuildindex('bbb.bbb','column [CUST_ACCT_ID] column [CHANNEL_TYPE_CD1] column [CHANNEL_TYPE_CD2] column [ORD_PRFL_CD] column [MCK_KU_TERM_RSN_CD] column [CUST_STAT_XMPT_CD] column [DLVRY_FEE_CD] column [MCK_KU_DEA_ELIG_CD1]');
call sp_rebuildindex('bbb.bbb','column [MCK_KU_DEA_ELIG_CD2] column [MCK_KU_DEA_ELIG_CD3] column [MCK_KU_DEA_ELIG_CD4] column [MCK_KU_DEA_ELIG_CD5] column [MCK_KU_DEA_ELIG_CD6] column [MCK_KU_DEA_ELIG_CD7] column [MCK_KU_DEA_ELIG_CD8]');
call sp_rebuildindex('bbb.bbb','column [MCK_KU_PVT_LBL_CD] column [ORDR_CONFO_CD] column [POG_OPTN_CD] column [POG_SIGNAGE_CD] column [OTC_RETL_PRC_HIER_CD] column [RX_RETL_PRC_HIER_CD] column [MCK_KU_CONSOL_TYP_CD] column [MCK_KU_MKTG_OPTN_CD]');

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Spliting the line based on position.

i want to split a big line based on the position. example : I have a single line which has 2300 characters. i want to split from 1 character to 300th characters as first line and 301th to 600 as second line and 601th to 900 as third line ...till the end of the string. Can anyone help... (1 Reply)
Discussion started by: senthil_is
1 Replies

2. Shell Programming and Scripting

Deleting Characters at specific position in a line if the line is certain length

I've got a file that would have lines similar to: 12345678 x.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 23456781 x.00 xx.00 xx.00 xx.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 34567812 x.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 45678123 x.00 xx.00 xx.00 xx.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 xx.00... (10 Replies)
Discussion started by: Cailet
10 Replies

3. Shell Programming and Scripting

sed limitation of 255 characters

Gurus, sed -e "s/\(.\{1,255\}\)\(.\{1,2\}\)\(.*\)/\1AB\3/" FILE ---this works sed -e "s/\(.\{1,468\}\)\(.\{1,2\}\)\(.*\)/\1AB\3/" FILE ---this does not It works only till 1,255 ( any number below 255 works) Any one know how to increase this limit. Thanks Sirababu (4 Replies)
Discussion started by: sirababu
4 Replies

4. Shell Programming and Scripting

Get the 1st 99 characters and add new line feed at the end of the line

I have a file with varying record length in it. I need to reformat this file so that each line will have a length of 100 characters (99 characters + the line feed). AU * A01 EXPENSE 6990370000 CWF SUBC TRAVEL & MISC MY * A02 RESALE 6990788000 Y... (3 Replies)
Discussion started by: udelalv
3 Replies

5. Shell Programming and Scripting

echo !SR | nc 255.255.2.2 80 - how to in XP?

Hi guys I am trying to interface with an old industrial scanner through an old PC with an old network card and a copy of Linux. It now needs to speak to a Windows XP machine, but I have no idea what the Windows equivalent of these functions would are: echo !1 | nc 255.255.2.2 80 echo ?2 | nc... (3 Replies)
Discussion started by: TonyG
3 Replies

6. Shell Programming and Scripting

Ignore the 255 character limit of command line

Hi I would just like to ask if there is a way for UNIX to ignore/overcome the 255 character limit of the command line? My problem is that I have a really long line of text from a file (300+ bytes) which i have to "echo" and process by adding commands like "sed" to the end of the line, like... (5 Replies)
Discussion started by: agentgrecko
5 Replies

7. UNIX for Dummies Questions & Answers

How to specify beginning-of-line/end-of-line characters inside a regex range

How can I specify special meaning characters like ^ or $ inside a regex range. e.g Suppose I want to search for a string that either starts with '|' character or begins with start-of-line character. I tried the following but it does not work: sed 's/\(\)/<do something here>/g' file1 ... (3 Replies)
Discussion started by: jawsnnn
3 Replies

8. Shell Programming and Scripting

[Solved] How to separate one line to mutiple line based on certain number of characters?

hi Gurus, I need separate a file which is one huge line to multiple lines based on certain number of charactors. for example: abcdefghi high abaddffdd I want to separate the line to multiple lines for every 4 charactors. the result should be abcd efgh i hi gh a badd ffdd Thanks in... (5 Replies)
Discussion started by: ken6503
5 Replies

9. Shell Programming and Scripting

Ksh: Read line parse characters into variable and remove the line if the date is older than 50 days

I have a test file with the following format, It contains the username_date when the user was locked from the database. $ cat lockedusers.txt TEST1_21062016 TEST2_02122015 TEST3_01032016 TEST4_01042016 I'm writing a ksh script and faced with this difficult scenario for my... (11 Replies)
Discussion started by: humble_learner
11 Replies

10. Shell Programming and Scripting

Remove first 2 characters and last two characters of each line

here's what im trying to do. i have a file containing lines similar to this: data.txt: 1hsRmRsbHRiSFZNTTA1dlEyMWFkbU5wUW5CSlIyeDFTVU5SYjJOSFRuWmpia0ZuWXpKV2FHTnRU 1lKUnpWMldrZFZaMG95V25oYQpSelEyWTBka2QyRklhSHBrUjA1b1kwUkJkd3BOVXpWM1lVaG5k... (5 Replies)
Discussion started by: SkySmart
5 Replies
IGAWK(1)							 Utility Commands							  IGAWK(1)

NAME
igawk - gawk with include files SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ... igawk [ all gawk options ] [ -- ] program-text file ... DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1). AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like @include getopt.awk in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path. OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports. EXAMPLES
cat << EOF > test.awk @include getopt.awk BEGIN { while (getopt(ARGC, ARGV, "am:q") != -1) ... } EOF igawk -f test.awk SEE ALSO
gawk(1) Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995. AUTHOR
Arnold Robbins (arnold@skeeve.com). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWgawk | +--------------------+-----------------+ |Interface Stability | Volatile | +--------------------+-----------------+ NOTES
Source for gawk is available on http://opensolaris.org. Free Software Foundation Nov 3 1999 IGAWK(1)
All times are GMT -4. The time now is 01:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy