Sponsored Content
Top Forums Shell Programming and Scripting splitting long string into several lines? Post 302434441 by durden_tyler on Friday 2nd of July 2010 02:18:02 PM
Old 07-02-2010
And for a few more cases -

Code:
$
$
$ cat barcodes
111111111111222222222222333333333333444444444444
555555555555
666666666666777777777777
888
8
88
88
8
888
99
99
99
 
 
99
99
99
$
$ perl -ne 'chomp; $x .= $_; if (length($x) >= 12){ do{$x=~/^(.{12})(.*)$/ and print $1,"\n" and $x=$2} until (length($x)<12) }' barcodes
111111111111
222222222222
333333333333
444444444444
555555555555
666666666666
777777777777
888888888888
999999999999
$
$

tyler_durden
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Help with splitting lines in a file using awk

I have a file which is one big long line of text about 10Kb long. Can someone provide a way using awk to introduce carriage returns every 40 chars in this file. Any other solutions would also be welcome. Thank you in advance. (5 Replies)
Discussion started by: martinbarretto
5 Replies

2. Shell Programming and Scripting

string splitting

Hi, I have a string like 'xyz' and i want to to split the above string into letters for comparision purpose. any idea pls. cheers RRK. (3 Replies)
Discussion started by: ravi raj kumar
3 Replies

3. Shell Programming and Scripting

Splitting a string

Hi, I am new to shell scripting, Can any body suggest me how I can split a string with a delimiter as whitespace into words and store into a array. I have read a line from file, now I want to split the line into words and store in a array for further use. eg : the sky is blue want... (3 Replies)
Discussion started by: smk
3 Replies

4. Shell Programming and Scripting

Splitting the line in multiple lines

Hi Guys, I need a help. I am pretty new to the shell level programing. I was trying to split a long lines to a multiple lines with few conditions. I goggle for the code and found some snippets and tried to modified it but I got few strange problems too. I have to split the lines if line is ... (3 Replies)
Discussion started by: dd_sh
3 Replies

5. UNIX for Dummies Questions & Answers

Splitting a string and putting another string in the middle?

Hello all! I'm trying to put together a small script that will take in a file name and attach a datestamp to the end of it (but before the file type extension). To illustrate... Before: filename.txt anotherfilename.txt After: filename_20090724.txt anotherfilename_20090724.txt ... (7 Replies)
Discussion started by: jisoo411
7 Replies

6. UNIX for Dummies Questions & Answers

Help with splitting a string..

Hello I need help with the following. I have strings like #if defined(__def1__) #if defined(__def1__) || defined(__def2__) #if defined(__def1__) && defined(__def2__) && defined(__def3__). #if defined(__def1__) || defined(__def2__) || defined(__def3__). I need to print what is there in... (4 Replies)
Discussion started by: srk
4 Replies

7. Shell Programming and Scripting

Splitting string with awk

Input: Debris Linux is a minimalist, desktop-oriented distribution and live CD based on Ubuntu. It includes the GNOME desktop and a small set of popular desktop applications, such as GNOME Office, Firefox web browser, Pidgin instant messenger, and ufw firewall manager. Debris Linux ships... (5 Replies)
Discussion started by: cola
5 Replies

8. Shell Programming and Scripting

Parsing a long string string problem for procmail

Hi everyone, I am working on fetchmail + procmail to filter mails and I am having problem with parsing a long line in the body of the email. Could anyone help me construct a reg exp for this string below. It needs to match exactly as this string. GetRyt... (4 Replies)
Discussion started by: cwiggler
4 Replies

9. Shell Programming and Scripting

Splitting one line into multiple lines

Hi, I have one problem scenorio as below. my source file is : cat input_file. "hi","there","how","are","you?","It","was","great","working","with","you.","hope","to","work","y ou." my output should be like. "hi","there","how","are","you?", "It","was","great","working","with",... (7 Replies)
Discussion started by: abhilash_nakka
7 Replies

10. Shell Programming and Scripting

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... (4 Replies)
Discussion started by: bubbawuzhere
4 Replies
Barcode::EAN13(3)					User Contributed Perl Documentation					 Barcode::EAN13(3)

NAME
GD::Barcode::EAN13 - Create EAN13(JAN13) barcode image with GD SYNOPSIS
ex. CGI use GD::Barcode::EAN13; binmode(STDOUT); print "Content-Type: image/png "; print GD::Barcode::EAN13->new('123456789012')->plot->png; with Error Check my $oGdBar = GD::Barcode::EAN13->new('123456789'); die $GD::Barcode::EAN13::errStr unless($oGdBar); #Invalid Length DESCRIPTION
GD::Barcode::EAN13 is a subclass of GD::Barcode and allows you to create EAN13(JAN13) barcode image with GD. This module based on "Generate Barcode Ver 1.02 By Shisei Hanai 97/08/22". new $oGdBar = GD::Barcode::EAN13->new($sTxt); Constructor. Creates a GD::Barcode::EAN13 object for $sTxt. $sTxt has 12 or 13 numeric characters([0-9]). If $sTxt has 12 characters, this module calacurates CD for you. plot() $oGd = $oGdBar->plot([Height => $iHeight, NoText => 0 | 1]); creates GD object with barcode image for the $sTxt specified at new method. $iHeight is height of the image. If NoText is 1, the image has no text image of $sTxt. ex. my $oGdB = GD::Barcode::EAN13->new('123456789012'); my $oGD = $oGdB->plot(NoText=>1, Height => 20); # $sGD is a GD image with Height=>20 pixels, with no text. barcode() $sPtn = $oGdBar->barcode(); returns a barcode pattern in string with '1', 'G' and '0'. '1' means black, 'G' also means black but little bit long, '0' means white. ex. my $oGdB = GD::Barcode::EAN13->new('123456789012'); my $sPtn = $oGdB->barcode(); # $sPtn = ''; $errStr $GD::Barcode::EAN13::errStr has error message. $text $oGdBar->{$text} has barcode text based on $sTxt specified in new method. AUTHOR
Kawai Takanori GCD00051@nifty.ne.jp COPYRIGHT
The GD::Barocde::EAN13 module is Copyright (c) 2000 Kawai Takanori. Japan. All rights reserved. You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file. SEE ALSO
GD::Barcode perl v5.16.3 2003-05-29 Barcode::EAN13(3)
All times are GMT -4. The time now is 12:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy