Inserting delimiter after a specific number of chars


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Inserting delimiter after a specific number of chars
# 1  
Old 10-02-2014
Inserting delimiter after a specific number of chars

Hello guys,

I have a problem where I need to add a delimiter, that can be | for example, after each 28000 chars.

The problem is that sometimes 1 row, which should contain 28000 chars is split in 2, so I want to put the delimiter after each 28000 so I will know the end of each row.

Please let me know of it doesn't make sense.

Thanks all

Last edited by rbatte1; 10-03-2014 at 12:50 PM.. Reason: Added ICODE tags round the pipe delimeter to highlight it better
# 2  
Old 10-02-2014
Welcome to the forum Diogo R Jesus.

It would be most helpful if you can post a relevant portion of the input you intend to use, an example of the expected output and lastly but not least, any script showing any efforts you have already tried.
# 3  
Old 10-03-2014
Perhaps an example working on an expected 30 characters would be more appropriate than a 28,000 character wide input!

Are you saying that you sometime get the input:-
Code:
123456789012345678901234567890
123456789012345678901234567890
123456789012345678901234567890123456789012345678901234567890
123456789012345678901234567890

.... and you want the output:-
Code:
123456789012345678901234567890|
123456789012345678901234567890|
123456789012345678901234567890|123456789012345678901234567890
123456789012345678901234567890|


Have I understood you correctly?



Robin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell script to split data with a delimiter having chars and special chars

Hi Team, I have a file a1.txt with data as follows. dfjakjf...asdfkasj</EnableQuotedIDs><SQL><SelectStatement modified='1' type='string'><! The delimiter string: <SelectStatement modified='1' type='string'><! dlm="<SelectStatement modified='1' type='string'><! The above command is... (7 Replies)
Discussion started by: kmanivan82
7 Replies

2. Shell Programming and Scripting

Replace specific column delimiter

Hi All, I have a file with a pipe delimiter. I need to replace the delimiter with html tags. I managed to get all the delimiters replaced along with first and last but the requirement is that I need to change 7th delimiter with slight change. File1: ... (2 Replies)
Discussion started by: shash
2 Replies

3. Shell Programming and Scripting

Inserting comma after a specific pattern

Hi Am using ksh shell I have a file like XYSDHY read write; permission; complete; DEGHLO RTERI dersa; upomxi oidewmiew; jdipowj;Now i need to insert semicolon after the BLOCK LETTER patterns and delete all blank lines. Now I need the output as XYSDHY; read write; permission;... (3 Replies)
Discussion started by: Priya Amaresh
3 Replies

4. UNIX for Dummies Questions & Answers

number of chars

I am curious why the below returns 4 instead of 3 wc -c <<<aaa Whereasa=aaa;echo ${#a} returns 3. How to get 3 using here -string operator in the above scenario Thanks (2 Replies)
Discussion started by: pandeesh
2 Replies

5. Shell Programming and Scripting

script for inserting line at specific place in file

I use zentyal for my server admin, which is great but zentyal auto-generates config file on boot and hence overwrites any changes made directly to config files. In order to allow multiple user access to a MS ACCESS database, I need to customise the smb.conf file and add the following line to the... (9 Replies)
Discussion started by: barrydocks
9 Replies

6. Shell Programming and Scripting

How to remove delimiter from specific column?

I have 5 column in sample txt file where in i have to create report based upon 1,3 and 5 th column.. I have : in first and third coulmn. But I want to retain the colon of fifth coulmn and remove the colon of first column.. 5th column contains String message (for example,... (7 Replies)
Discussion started by: Shirisha
7 Replies

7. Shell Programming and Scripting

Problem inserting text into file after specific line

this is utterly embarassing :( after posting here i revisited my files and found that when i used "vi" instead of a gui based editor, i suddenly found that the indentations were in fact wrong :( sorry about this :( (0 Replies)
Discussion started by: mocca
0 Replies

8. Shell Programming and Scripting

Inserting double quotes after third delimiter

Hi, I'm trying to insert double quotes right after the third delimiter in a file. Delimiter is ^Z. For example: Input: Oct ^Z 1234 ^Z John ^Z Hello!" Desired Output: Oct ^Z 1234 ^Z John ^Z "Hello!" Any ideas? (1 Reply)
Discussion started by: kangaroo
1 Replies

9. UNIX for Dummies Questions & Answers

Inserting a delimiter after certain charater position

Hi, I have a string : - ICFFHASMTAAMPFINCL22082006000002548789632 and i want to add delimiter after certain charater position through a script, eg. ICFFH,ASMTAAMPF,INCL,22082006,000002548789632. I have tried and am able to achieve it through cut-paste. But i don't want to use cut paste as it... (6 Replies)
Discussion started by: divz
6 Replies

10. UNIX for Dummies Questions & Answers

Inserting specific lines in vi

How can I insert, say lines 500 - 700 from another file into the current file on the current line (cursor) that I am editing while in vi (AIX). I know how to insert the entire file but how do you do it when you only need certain lines from a huge file? I've referenced my Unix Unleash book but... (2 Replies)
Discussion started by: giannicello
2 Replies
Login or Register to Ask a Question