Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Cut each line based on the character size Post 302995353 by JoshvaPeter on Tuesday 4th of April 2017 11:51:05 PM
Old 04-05-2017
We need to append each line to a file. If the characters of the appended line is more than 255 then it should create another file but the line should not break. For eg: file:1 contains only 227 characters if we add the next line then it will be more than 255 and at the same time all the line should have call command in order to execute the index rebuild.

Eg:

Code:
head -10 indexcreationsql.out2
call sp_iqrebuildindex('DTC_TRANS.dtc_error_log_vw','column [create_dt]');
call sp_iqrebuildindex('DTC_TRANS.dtc_error_log_vw','column [created_by]');
call sp_iqrebuildindex('DTC_TRANS.dtc_error_log_vw','column [error_code]');
call sp_iqrebuildindex('DTC_TRANS.dtc_error_log_vw','column [other_desc]');
call sp_iqrebuildindex('DTC_TRANS.dtc_error_log_vw','column [resolved_by]');
call sp_iqrebuildindex('DTC_TRANS.dtc_error_log_vw','column [error_log_id]');
call sp_iqrebuildindex('DTC_TRANS.dtc_error_log_vw','column [program_name]');
call sp_iqrebuildindex('DTC_TRANS.dtc_error_log_vw','column [resolve_date]');
call sp_iqrebuildindex('DTC_TRANS.dtc_error_log_vw','column [last_update_dt]');
call sp_iqrebuildindex('DTC_TRANS.dtc_error_log_vw','column [procedure_name]');

Output:
file:1
Code:
call sp_iqrebuildindex('DTC_TRANS.dtc_error_log_vw','column [create_dt]'); call sp_iqrebuildindex('DTC_TRANS.dtc_error_log_vw','column [created_by]');

file:2
Code:
call sp_iqrebuildindex('DTC_TRANS.dtc_error_log_vw','column [other_desc]');call sp_iqrebuildindex('DTC_TRANS.dtc_error_log_vw','column [resolved_by]');call sp_iqrebuildindex('DTC_TRANS.dtc_error_log_vw','column [error_log_id]');



Moderator's Comments:
Mod Comment Seriously: Please use CODE tags as required by forum rules!

Last edited by RudiC; 04-05-2017 at 04:45 AM.. Reason: Added CODE tags.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

delete a line based on first character of the line

Hi, I need to delete all lines in a file which starts with "|" character. Can some one assist me? Thanks (2 Replies)
Discussion started by: borncrazy
2 Replies

2. Shell Programming and Scripting

Read line based on character,

Hi Experts, I have called file1.txt contains below CREATE TABLE "IHUBDEV2"."TLM_BREAK_RULES" ( "OID" VARCHAR2(32) NOT NULL ENABLE, "TLM_PAY_CLASS_OID" VARCHAR2(32) NOT NULL ENABLE, "PUNCHED_BREAKS" NUMBER(1,0) DEFAULT 0 NOT NULL ENABLE, "NORMAL_BREAKS"... (3 Replies)
Discussion started by: naree
3 Replies

3. Shell Programming and Scripting

Cut multiple data based on character position

How to extract multiple data based on character position. I need to fetch from 7-9 and 22-26 and there is no delimiter for 22-26 since it is part of the column. The file may have more than 1000 character long.I managed to pull any one but not both for example test data 12345 zxc vbnmlk... (1 Reply)
Discussion started by: zooby
1 Replies

4. UNIX for Advanced & Expert Users

cut words based on the word count of a line

I would like to cut words based on the word count of a line. This over here inspired me with some ideas but I wasn't able to get what I needed. https://www.unix.com/shell-programming-scripting/105841-count-words-each-line-file-using-xargs.html If the line has 6 words I would like to use this.... (8 Replies)
Discussion started by: cokedude
8 Replies

5. Shell Programming and Scripting

cut a line after a character

hello! i'd like to ask if there's a way using sed in order to cut every character of a line after a certain character.My output looks like this: blabla blavbla blabla # bla bla bla and i want it to be : blabla blavbla blabla thanks in advance (5 Replies)
Discussion started by: vlm
5 Replies

6. Shell Programming and Scripting

Delete line based on count of specific character

I'm looking for what I hope might be a one liner along these lines: sed '/a line with more than 3 pipes in it/d' I know how to get the pipe count in a string and store it in a variable, but I'm greedy enough to hope that it's possible via regex in the /.../d context. Am I asking too much? ... (5 Replies)
Discussion started by: tiggyboo
5 Replies

7. Shell Programming and Scripting

cut a line into different fields based on identifiers

cat fileanme.txt custom1=, custom2=, userPulseId=3005, accountPolicyId=1, custom3=, custom4=, homeLocationId=0, i need to make the fields appear in next line based on identifier (,) ie comma so output should read cat fileanme.txt custom1=, custom2=, userPulseId=3005, ... (8 Replies)
Discussion started by: vivek d r
8 Replies

8. UNIX for Dummies Questions & Answers

Looking for command line to find dirs based on size and date

Hi, My first time on this site, please excuse me if I've come to the wrong forum. I'm fairly new to Unix/Linux and hoping you can help me out. I'm looking for a command line that will return a list of directories that are larger than 50M and older than 2 days. I thought it may be... (6 Replies)
Discussion started by: Wisconsingal
6 Replies

9. UNIX for Dummies Questions & Answers

Cut command doesn't remove (^C) character from only first line

I have a file which has first 2 junk characters(X^C) at beginning of each line in file. When i run cut -c 2- filename it removes junk characters from all lines except on first line it keeps one junk character control C(^C). Not sure why it is not removing only from first line. (2 Replies)
Discussion started by: later_troy
2 Replies

10. UNIX for Beginners Questions & Answers

Append each line based upon the character size

I have a huge file which contains multiple lines. It need to check whether character length is not more than 255 each line. If its not then it should remove the character up to column. I have described in the output below. If its more than that the next line should start with call but if the... (1 Reply)
Discussion started by: JoshvaPeter
1 Replies
DB2_FIELD_DISPLAY_SIZE(3)						 1						 DB2_FIELD_DISPLAY_SIZE(3)

db2_field_display_size - Returns the maximum number of bytes required to display a column

SYNOPSIS
int db2_field_display_size (resource $stmt, mixed $column) DESCRIPTION
Returns the maximum number of bytes required to display a column in a result set. PARAMETERS
o $stmt - Specifies a statement resource containing a result set. o $column - Specifies the column in the result set. This can either be an integer representing the 0-indexed position of the column, or a string containing the name of the column. RETURN VALUES
Returns an integer value with the maximum number of bytes required to display the specified column. If the column does not exist in the result set, db2_field_display_size(3) returns FALSE. SEE ALSO
db2_field_name(3), db2_field_num(3), db2_field_precision(3), db2_field_scale(3), db2_field_type(3), db2_field_width(3). PHP Documentation Group DB2_FIELD_DISPLAY_SIZE(3)
All times are GMT -4. The time now is 02:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy