Break one long string into multiple fixed length lines
This is actually a KSH under Unix System Services (Z/OS), but hoping I can get a standard AIX/KSH solution to work...
I have a very large, single line file in Windows, that we download via FTP, with the "SITE WRAP" option, into a Z/OS file with an LRECL of 200. This essentially breaks the single long line down into multiple 200 byte records.
We are converting from FTP, to (OPENSSH) SFTP, which unfortunately does not include the "SITE WRAP" ability. Therefore, I'm attempting to come up with another means of accomplishing the task.
I have downloaded the file to USS, and have written a simple script to read in the record and split it out into multiple, 200 byte records, and write those out to a new file...
However, this is not working as USS is apparently unable to read in the entire record into the TLINE variable...
So, does anyone have any suggestions on how else to break it down? Being a mainframe dinosaur, I have yet to wrap my head around the "sed" and "awk" commands, but hoping maybe there is something like that, which would accomplish this.
Since 'fold' also depends upon standard input, doesn't that limit the line length to the system default max line length.
An alternative solution would be to write a cobol program using GNUcobol, making the input file sequential with fixed record length (ie no record separator), and the output file line sequential.
If I correctly understand what you're trying to do (and since you aren't quoting the expansion of $NLINE in your echo statement, I'm not sure that I do), you might find that using dd is a lot easier than writing a COBOL program:
This will strip off trailing space characters from your input file (like your echo does), but it won't strip leading whitespace and won't convert sequences of spaces and tabs in the middle of your input lines to a single space (like your echo does).
Hi Team,
I have an issue to split the file which is having special chracter(German Char) using awk command.
I have a different length records in a file. I am separating the files based on the length using awk command.
The command is working fine if the record is not having any... (7 Replies)
I need to break the line after every 3rd semi colon(;) using Unix shell scripting
Input.txt
ABC;DEF;JHY;LKU;QWE;BVF;RGHY;
Output.txt
ABC;DEF;JHY;
LKU;QWE;BVF;
RGHY; (1 Reply)
I have a big file having 100 K lines.
I have to read each line and see at 356 character position whethere there is a word "W" in it. If it is their then don't delete the line otherwise delete it.
There are two lines as one Header and one trailer which should remain same.
Can somebody... (5 Replies)
Hi,
I need to split a file based on last occurece of a string. PFB the explanation
I have a file in following format
aaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbb
ccccccccccccccccccccccccccc
ddddddddddddddddddddddddddd
3186rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr... (4 Replies)
I have a peculiar file with record format like given below. Each line is wrapped to next lines after certain number of characters. I want to concatenate all wrapped lines into 1.
Input:(wrapped after 10 columns)
This is li
ne1
This is li
ne2 and
this line
is too lo
ng
Shortline
... (8 Replies)
Hi,
I have a fixed length file where I need to verify the values of 3 different fields, where each field will have a different value.
How can I do that in a single step. (6 Replies)
Problem:
entry_name="joke:hello:yellow:blue:default"
print("%d %-12s\t%-10s\t%-5s\n", $i, $entry_name....);
I just want to print the output like this
index entry value ....
1 joke:hello:y 0 123 567
ellow:blue:d
... (1 Reply)
Is there a command that sets a variable length?
I have a input of a variable length field but my output for that field needs to be set to 32 char.
Is there such a command?
I am on a sun box running ksh
Thanks (2 Replies)