Sponsored Content
Top Forums Shell Programming and Scripting cutting long text by special char around 100 byte and newline Post 302579845 by Shawn, Lee on Tuesday 6th of December 2011 09:16:51 PM
Old 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

Serial printer cutting last page of long reports...

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

Using egrep to search for Text and special char

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

How to replace any char with newline char.

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

Splitting a variable based on newline char

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

Help substituting text in a file having a single line but no newline char

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

Remove a newline char from selected rows.

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

Remove newline char from variable

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

Changing a special line and Byte in a random file

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

Replace Special Character With Next Present Byte

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

Char/byte positions of delimiters in file

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
Pod::Eventual(3pm)					User Contributed Perl Documentation					Pod::Eventual(3pm)

NAME
Pod::Eventual - read a POD document as a series of trivial events VERSION
version 0.093170 SYNOPSIS
package Your::Pod::Parser; our $VERSION = '0.093170'; use base 'Pod::Eventual'; sub handle_event { my ($self, $event) = @_; print Dumper($event); } DESCRIPTION
POD is a pretty simple format to write, but it can be a big pain to deal with reading it and doing anything useful with it. Most existing POD parsers care about semantics, like whether a "=item" occurred after an "=over" but before a "back", figuring out how to link a "L<>", and other things like that. Pod::Eventual is much less ambitious and much more stupid. Fortunately, stupid is often better. (That's what I keep telling myself, anyway.) Pod::Eventual reads line-based input and produces events describing each POD paragraph or directive it finds. Once complete events are immediately passed to the "handle_event" method. This method should be implemented by Pod::Eventual subclasses. If it isn't, Pod::Eventual's own "handle_event" will be called, and will raise an exception. METHODS
read_handle Pod::Eventual->read_handle($io_handle, \%arg); This method iterates through the lines of a handle, producing events and calling the "handle_event" method. The only valid argument in %arg (for now) is "in_pod", which indicates whether we should assume that we are parsing pod when we start parsing the file. By default, this is false. This is useful to behave differently when reading a .pm or .pod file. read_file This behaves just like "read_handle", but expects a filename rather than a handle. read_string This behaves just like "read_handle", but expects a string containing POD rather than a handle. handle_event This method is called each time Pod::Evental finishes scanning for a new POD event. It must be implemented by a subclass or it will raise an exception. handle_nonpod This method is called each time a non-POD segment is seen -- that is, lines after "=cut" and before another command. If unimplemented by a subclass, it does nothing by default. handle_blank This method is called at the end of a sequence of one or more blank lines. If unimplemented by a subclass, it does nothing by default. EVENTS
There are four kinds of events that Pod::Eventual will produce. All are represented as hash references. Command Events These events represent commands -- those things that start with an equals sign in the first column. Here are some examples of POD and the event that would be produced. A simple header: =head1 NAME { type => 'command', command => 'head1', content => "NAME ", start_line => 4 } Notice that the content includes the trailing newline. That's to maintain similarity with this possibly-surprising case: =for HTML We're actually still in the command event, here. { type => 'command', command => 'for', content => "HTML We're actually still in the command event, here. ", start_line => 8, } Pod::Eventual does not care what the command is. It doesn't keep track of what it's seen or whether you've used a command that isn't defined. The only special case is "=cut", which is never more than one line. =cut We are no longer parsing POD when this line is read. { type => 'command', command => 'cut', content => " ", start_line => 15, } Waiving this special case may be an option in the future. Text Events A text event is just a paragraph of text, beginning after one or more empty lines and running until the next empty line (or =cut). In Perl 5's standard usage of Pod, text content that begins with whitespace is a "verbatim" paragraph, and text content that begins with non- whitespace is an "ordinary" paragraph. Pod::Eventual doesn't care. Text events look like this: { type => 'text', content => "a string of text ending with a ", start_line => 16, } Blank events These events represent blank lines (or many blank lines) within a Pod section. Blank events look like this: { type => 'blank', content => " ", start_line => 21, } Non-Pod events These events represent non-Pod segments of the input. Non-Pod events look like this: { type => 'nonpod', content => "#!/usr/bin/perl use strict; use Acme::ProgressBar ", start_line => 1, } AUTHOR
Ricardo SIGNES <rjbs@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2009 by Ricardo SIGNES. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.10.1 2009-11-13 Pod::Eventual(3pm)
All times are GMT -4. The time now is 02:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy