12-06-2011
cutting long text by special char around 100 byte and newline
Regard,
How can i cut the text by special char(|) around 100 byte
and write the other of the text at newline using Perl.
2|01|2059140001|34232883774|504106542|2733|2127292||55197897292|||||177011612201|87829918247|2011112 7|0|0|0|295438|251|573|0|0|0|0|0|0|0|0|0|0|0|54630|45890|93609|0|0|0|295330|0|0|||0
Thanks.
Last edited by Shawn, Lee; 12-07-2011 at 12:03 AM..
10 More Discussions You Might Find Interesting
1. Debian
Any ideas what could cause this? I have flow control set to XON XOFF on the printer and the on the OS level. (1 Reply)
Discussion started by: djsal
1 Replies
2. UNIX for Advanced & Expert Users
Anyone is well-versed to use egrep to search a file for a line containing both:
1) AAA
2) $
I am having problem escaping the dollar sign when using egrep in conjunction with satisfying AAA as well.
E.g. Text file
Line 1 AAA
Line 2 $$$
Line 3 AAA BBB $
Line 4 $$$ BBB AA
will return me... (2 Replies)
Discussion started by: izy100
2 Replies
3. Shell Programming and Scripting
Hi,
How to replace any character in a file with a newline character using sed ..
Ex:
To replace ',' with newline
Input:
abcd,efgh,ijkl,mnop
Output:
abcd
efgh
ijkl
mnop
Thnx in advance.
Regards,
Sasidhar (5 Replies)
Discussion started by: mightysam
5 Replies
4. Shell Programming and Scripting
Heeloo all,
A weird problem perhaps. May god save others from this problem.
I want to print each line from a variable.. the example below should make it clear.
smvar="Hello World1
Hello world 2
forgot there I guess"
for eachline in $smvar
echo $eachline
end
Whats for... (3 Replies)
Discussion started by: pavanlimo
3 Replies
5. Shell Programming and Scripting
Hello,
Need help substituting a particular word in a file having a single line but no newline character at the end.
I was trying to use sed but it doesn't work probably because there is no newline char at the end of the line.
$ cat hlq_detail
/outputs/alvan23/PDFs/bills
$ cat... (5 Replies)
Discussion started by: Shan_u2005
5 Replies
6. UNIX for Dummies Questions & Answers
Greetings!
Can we automate the process of removing a newline char from selected rows in a fixed width file using a shell?
Input is like
abcd1234
xyzd1234
abcd
a1b2c3d4
abcd1234
xyzd1234
xx
abcd1234
Expected output -
abcd1234xyzd1234
abcda1b2c3d4abcd1234xyzd1234
xxabcd1234
... (2 Replies)
Discussion started by: mailme0205
2 Replies
7. UNIX for Dummies Questions & Answers
I have a file ABC.DAT with 2 columns avaialble
Data format :
XYZ!$#$!120
XXZ!$#$!1000
YYZ!$#$!104
While running the following code :
FILE_COUNTER=1;
RECORD_CN_FILE_COUNT=$((`wc -l ABC.DAT| cut -f1 -d' '`));
while
do
FILE_NAME=`cat ABC.DAT.DAT| head -$FILE_COUNTER |tail -1 | awk -F... (1 Reply)
Discussion started by: Nikhil Gautam
1 Replies
8. UNIX for Dummies Questions & Answers
Hello
I created 3 files by:
dd if=/dev/urandom bs=1024 count=1000000 of=./testfile1
dd if=/dev/urandom bs=1024 count=5000000 of=./testfile2
dd if=/dev/urandom bs=1024 count=10000000 of=./testfile3
Now I want to know how to make a change in a specific byte and/or line of theses files? (2 Replies)
Discussion started by: frhling
2 Replies
9. Shell Programming and Scripting
Hi,
First find the special character, from the special character take next two bytes convert the bytes to decimal and replace with next present byte of decimal value times.
E.g.
Input: 302619ú1A?
Output: 302619(3 spaces for ú1A)??????????????????????????
Thanks,
Dines (27 Replies)
Discussion started by: dineshnak
27 Replies
10. Shell Programming and Scripting
I have a pipe delimited file and I'm trying to write a script that will give the character/byte positions of each pipe in the file. There may be some simple way but I don't know what it is... Can someone help with this?
Ex: file has output below
abc|def|ghi|
I want the script to tell the... (1 Reply)
Discussion started by: basz808
1 Replies
LEARN ABOUT ULTRIX
xstorebuffer
XStoreBytes(3X11) MIT X11R4 XStoreBytes(3X11)
Name
XStoreBytes, XStoreBuffer, XFetchBytes, XFetchBuffer, XRotateBuffers - manipulate cut and paste buffers
Syntax
XStoreBytes(display, bytes, nbytes)
Display *display;
char *bytes;
int nbytes;
XStoreBuffer(display, bytes, nbytes, buffer)
Display *display;
char *bytes;
int nbytes;
int buffer;
char *XFetchBytes(display, nbytes_return)
Display *display;
int *nbytes_return;
char *XFetchBuffer(display, nbytes_return, buffer)
Display *display;
int *nbytes_return;
int buffer;
XRotateBuffers(display, rotate)
Display *display;
int rotate;
Arguments
buffer Specifies the buffer in which you want to store the bytes or from which you want the stored data returned.
bytes Specifies the bytes, which are not necessarily ASCII or null-terminated.
display Specifies the connection to the X server.
nbytes Specifies the number of bytes to be stored.
nbytes_return
Returns the number of bytes in the buffer.
rotate Specifies how much to rotate the cut buffers.
Description
Note that the cut buffer's contents need not be text, so zero bytes are not special. The cut buffer's contents can be retrieved later by
any client calling
can generate a error.
If the property for the buffer has never been created, a error results.
can generate and errors.
The function returns the number of bytes in the nbytes_return argument, if the buffer contains data. Otherwise, the function returns NULL
and sets nbytes to 0. The appropriate amount of storage is allocated and the pointer returned. The client must free this storage when
finished with it by calling Note that the cut buffer does not necessarily contain text, so it may contain embedded zero bytes and may not
terminate with a null byte.
The function returns zero to the nbytes_return argument if there is no data in the buffer.
can generate a error.
The function rotates the cut buffers, such that buffer 0 becomes buffer n, buffer 1 becomes n + 1 mod 8, and so on. This cut buffer num-
bering is global to the display. Note that generates errors if any of the eight buffers have not been created.
can generate a error.
Diagnostics
The server failed to allocate the requested resource or server memory.
A value for an Atom argument does not name a defined Atom.
Some argument or pair of arguments has the correct type and range but fails
to match in some other way required by the request.
Some numeric value falls outside the range of values accepted by the request.
Unless a specific range is specified for an argument, the full range defined by the argument's type is accepted. Any argument
defined as a set of alternatives can generate this error.
See Also
XFree(3X11)
X Window System: The Complete Reference, Second Edition, Robert W. Scheifler and James Gettys
XStoreBytes(3X11)