Sponsored Content
Top Forums Shell Programming and Scripting Breaking long lines into (characters, newline, space) groups Post 302316515 by rowie718 on Friday 15th of May 2009 10:24:53 AM
Old 05-15-2009
Thank you ghostdog,

First let me state that I am totally unfamiliar with python. However, if it solves this problem for me, I would be glad to learn a bit and use it. There are a few issues I noticed upon trying the code you provided, ranked in order of importance:

1) The code seems to eliminate blank lines from the source text. I need it to not do that. Example:

1111

2222

becomes

1111
2222

2) I dont know how to output to a file rather than the standard output. I apologize for the rookie question here.

3) Ideally I would like for there to be a way to interactively input the location of the file so it doesnt need to be hardcoded. If this is too much to ask though, I can live without it.

Generally I would prefer to use sed/awk since I have some familiarity with them and bash scripting, however I will use whatever solutions are presented that fully solve this problem. I really appreciate the assistance.

Cheers.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

remove trailing newline characters

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)
Discussion started by: shweta_d
7 Replies

2. UNIX for Dummies Questions & Answers

non-breaking space question

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)
Discussion started by: runmeat6
1 Replies

3. Shell Programming and Scripting

Replace long space to become one space?

Hi, i have the log attached. Actually i want the long space just become 1 space left like this : Rgds, (12 Replies)
Discussion started by: justbow
12 Replies

4. Ubuntu

Disk Space lost mysteriously upon breaking a process.

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)
Discussion started by: morningSunshine
4 Replies

5. UNIX for Dummies Questions & Answers

Breaking up a text file into lines

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)
Discussion started by: evelibertine
3 Replies

6. Shell Programming and Scripting

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. ... (3 Replies)
Discussion started by: Shawn, Lee
3 Replies

7. Shell Programming and Scripting

awk: searching for non-breaking-space

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)
Discussion started by: sdf
1 Replies

8. Shell Programming and Scripting

Breaking lines which contains more than 50 characters in a file

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)
Discussion started by: wenclu
3 Replies

9. Shell Programming and Scripting

Newline characters in fields of a file

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)
Discussion started by: lakshmi001
6 Replies

10. Shell Programming and Scripting

Mailx appending exclamation mark and newline in a long line

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
Vend::Payment::TCLink(3pm)				User Contributed Perl Documentation				Vend::Payment::TCLink(3pm)

NAME
Vend::Payment::TCLink - Interchange TrustCommerce Support SYNOPSIS
&charge=trustcommerce or [charge mode=trustcommerce param1=value1 param2=value2] PREREQUISITES
Net::TCLink http://www.trustcommerce.com/tclink.html and CPAN both have this module, which actually does the bulk of the work. All that Vend::Payment::TCLink does is to massage the payment data between Interchange and Net::TCLink. DESCRIPTION
The Vend::Payment::TCLink module implements the trustcommerce() routine for use with Interchange. It is compatible on a call level with the other Interchange payment modules. To enable this module, place this directive in "interchange.cfg": Require module Vend::Payment::TCLink This must be in interchange.cfg or a file included from it. Make sure CreditCardAuto is off (default in Interchange demos). The mode can be named anything, but the "gateway" parameter must be set to "trustcommerce". To make it the default payment gateway for all credit card transactions in a specific catalog, you can set in "catalog.cfg": Variable MV_PAYMENT_MODE trustcommerce It uses several of the standard settings from Interchange payment. Any time we speak of a setting, it is obtained either first from the tag/call options, then from an Interchange order Route named for the mode, then finally a default global payment variable, For example, the "id" parameter would be specified by: [charge mode=trustcommerce id=YourTrustCommerceID] or Route trustcommerce id YourTrustCommerceID or Variable TRUSTCOMMERCE_ID YourTrustCommerceID The active settings are: id Your TrustCommerce customer ID, supplied by TrustCommerce when you sign up. Global parameter is TRUSTCOMMERCE_ID. secret Your TrustCommerce customer password, supplied by TrustCommerce when you sign up. Global parameter is TRUSTCOMMERCE_SECRET. transaction The type of transaction to be run. Valid values are: Interchange TrustCommerce ---------------- ----------------- auth preauth return credit sale sale settle postauth Global parameter is TRUSTCOMMERCE_ACTION. avs Whether AVS (Address Verification System) is enabled. Valid values are "y" for enabled and "n" for disabled. Global parameter is TRUSTCOMMERCE_AVS. remap This remaps the form variable names to the ones needed by TrustCommerce. See the "Payment Settings" heading in the Interchange documentation for use. test Set this to "TRUE" if you wish to operate in test mode, i.e. set the TrustCommerce "demo" query paramter to TRUE. Examples: Route trustcommerce test TRUE or Variable TRUSTCOMMERCE_TEST TRUE or [charge mode=trustcommerce test=TRUE] Troubleshooting Try the instructions above, then enable test mode. A test order should complete. Disable test mode, then test in various TrustCommerce error modes by using the credit card number 4222 2222 2222 2222. Then try a sale with the card number "4111 1111 1111 1111" and a valid expiration date. The sale should be denied, and the reason should be in [data session payment_error]. If nothing works: o Make sure you "Require"d the module in interchange.cfg: Require module Vend::Payment::TrustCommerce o Make sure Net::TCLink is installed and working. You can test to see whether your Perl thinks they are: perl -MNet::TCLink -e 'print "It works. "' If it "It works." and returns to the prompt you should be OK (presuming they are in working order otherwise). o Check the error logs, both catalog and global. o Make sure you set your payment parameters properly. o Try an order, then put this code in a page: <XMP> [calc] my $string = $Tag->uneval( { ref => $Session->{payment_result} }); $string =~ s/{/{ /; $string =~ s/,/, /g; return $string; [/calc] </XMP> That should show what happened. o If all else fails, TrustCommerce consultants are available to help you out. See http://www.trustcommerce.com/contact.html for more information, or email developer@trustcommerce.com BUGS
There is actually nothing *in* Vend::Payment::TrustCommerce. It changes packages to Vend::Payment and places things there. AUTHORS
Dan Helfman <dan@trustcommerce.com>, based on code by Mark Stosberg <mark@summersault.com>, which was based on original code by Mike Heins. CREDITS
webmaster@nameastar.net Jeff Nappi <brage@cyberhighway.net> Paul Delys <paul@gi.alaska.edu> perl v5.14.2 2011-03-09 Vend::Payment::TCLink(3pm)
All times are GMT -4. The time now is 03:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy