I put together your suggestions and tested them. Its almost there, but there were 2 problems. The first I fixed fairly easily. The 79th character is the newline in the orignal ldif, so I shouldve expressed it as wanting 78 characters. I deducted 1 from anywhere I saw 79 or 80 in your awk command and that seemed to do the trick. The second problem is trickier. Take a 240 character line as an example. When the awk command breaks it, and adds the space in the second chunk, it does not take into account that the last character of that second chunk should be at the same ending position as the first chunk. As it is currently written, all chunks after the first break align 1 character to the right because of the space.
Example:
Thanks again for your help, I really appreciate it.
Hello ,
I have the folowing scenario :
I have a text file as follows : (say name.txt)
ABC
DEF
XYZ
And I have one more xml file as follows : (say somexml.xml)
<Name>ABC</Name>
<Age>12</Age>
<Class>D</Class>
<Name>XYZ</Name>
<Age>12</Age>
<Class>D</Class>
<Name>DEF</Name>... (7 Replies)
Might anyone know how to make a nbsp (160|0xA0) character? I am using a Dell Latitude D620 running Windows XP and then starting Exceed 9.0 defaulting to native window emulation for my X (us.kbf keymapping) (Latin-1 symbol set I believe) and calling an xterm (fontdefault, whatever that might be)... (1 Reply)
Hi All,
Today when I was working on a script to generate custom wordlist. So I ran a script and the output was directed to /tmp.
The disk space was around 19 gb. While the script was running, I decided to direct the o/p file to my 1TB drive. So I broke the run using Ctrl + C.
Now when I... (4 Replies)
Hi,
I have a space delimited text file that looks like the following:
BUD31 YRI 2e-06:CXorf15 YRI 3e-06:CREB1 YRI 4e-06
FLJ21438 CEU 3e-07:ETS1 CEU 8e-07:FGD3 CEU 2e-06
I want to modify the text file so that everytime there is a ":", a new line is introduced so that the document looks... (3 Replies)
This code shal search for the non-breaking space 0xA0 though it returns the error "fatal: attempt to use scalar 'nbs' as array" Can somebody help?
awk --non-decimal-data -v nbs="0xA0" '{if($0 in nbs) {print FILENAME, NR}}' *.txt (1 Reply)
Hi,
I have a file which contains many lines. Some of them are longer than 50 chars. I want to break those lines but I don't want to break words, e.g. the file
This is an exemplary text which should be broken aaaaaa bbbbb ccccc
This is the second line
This line should also be broken... (3 Replies)
My source file is pipe delimeted file with 53 fields.In 33 rd column i am getting mutlple new line characters,dule to that record is breaking into multiple records.
Note : here record delimter also \n
sample Source file with 6 fields :
1234|abc| \nabcd \n bvd \n cde \n |678|890|900\n
... (6 Replies)
Hi,
I have a shell script which automates reporting and at times, requires the report line to be very long (sometimes as long as 2131 chars). The output I get is similar to this:
XXXX XXXXXXX 16:15 3.24% 5.07% 3.69% 5.23% 3.68% 4.06% 3.57% 5.03% 4.31% 5.11% 3.49% 4.19% 4.31% ... (2 Replies)
Discussion started by: gilberteu
2 Replies
LEARN ABOUT PHP
iconv_substr
ICONV_SUBSTR(3) 1 ICONV_SUBSTR(3)iconv_substr - Cut out part of a stringSYNOPSIS
string iconv_substr (string $str, int $offset, [int $length = iconv_strlen($str, $charset)], [string $charset = ini_get("iconv.inter-
nal_encoding")])
DESCRIPTION
Cuts a portion of $str specified by the $offset and $length parameters.
PARAMETERS
o $str
- The original string.
o $offset
- If $offset is non-negative, iconv_substr(3) cuts the portion out of $str beginning at $offset'th character, counting from zero.
If $offset is negative, iconv_substr(3) cuts out the portion beginning at the position, $offset characters away from the end of
$str.
o $length
- If $length is given and is positive, the return value will contain at most $length characters of the portion that begins at
$offset (depending on the length of $string). If negative $length is passed, iconv_substr(3) cuts the portion out of $str from
the $offset'th character up to the character that is $length characters away from the end of the string. In case $offset is also
negative, the start position is calculated beforehand according to the rule explained above.
o $charset
- If $charset parameter is omitted, $string are assumed to be encoded in iconv.internal_encoding. Note that $offset and $length
parameters are always deemed to represent offsets that are calculated on the basis of the character set determined by $charset,
whilst the counterpart substr(3) always takes these for byte offsets.
RETURN VALUES
Returns the portion of $str specified by the $offset and $length parameters.
If $str is shorter than $offset characters long, FALSE will be returned.
SEE ALSO substr(3), mb_substr(3), mb_strcut(3).
PHP Documentation Group ICONV_SUBSTR(3)