usage of module Text::Wrap;


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting usage of module Text::Wrap;
# 1  
Old 06-04-2008
usage of module Text::Wrap;

hi, i want to use module Text::Wrap.
this module provides the option $Text::Wrap::tabstop to change the tabstop from 8 blanks to any nummer.
i want to set it to 30 blanks. but when i change the nummer of blanks nothing happens.

Code:
Text::Wrap::tabstop = 30;
$wtd = wrap("","\t",$1);

or do i have to use another 2nd parameter then tab in wrap() ???

thx
# 2  
Old 06-04-2008
What's in $1? The documentation suggests it should be an array of text lines. (You do know that $1 is the string matched by the first set of parentheses of the latest regex match?)
# 3  
Old 06-04-2008
sure i know what is in $1. after some hours i found out that the function $Text::Wrap:tabstop does not agree with what i tought, but i also don't know what it really does by now. Smilie
# 4  
Old 06-05-2008
When text has leading whitespace, it replaces runs of n spaces with a tab character. Normally n should be 8, as that is the hardwired tab width of most terminals, but you can change it to something else if you need to. (I suspect you don't, though.)

The first parameter to wrap says how to indent the first line, and the second parameter says how to indent subsequent lines. If you want them indented by thirty spaces, try " " x 30 for the second parameter.

Code:
vnix$ perl -MText::Wrap -e 'print wrap(""," " x 30, <>)' /etc/motd | head -5
Linux indeed 2.6.24-17-generic #1 SMP Thu May 1 13:57:17 UTC 2008 x86_64
                              
                              The programs included with the Ubuntu system
                              are free software;
                              the exact distribution terms for each program


Last edited by era; 06-05-2008 at 03:11 AM.. Reason: Add example output
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

CPU Usage statistics Dump in a text file over a period of time

I am facing issue related to performance of one customized application running on RHEL 5.9. The application stalls for some unknown reason that I need to track. For that I require some tool or shell scripts that can monitor the CPU usage statistics (what we get in TOP or in more detail by other... (6 Replies)
Discussion started by: Anjan Ganguly
6 Replies

2. Shell Programming and Scripting

Python/GTK Text Wrap Question . . .

Greetings! After some cut-and-try, I've cobbled together the following bit of basic code:#!/usr/bin/python import gtk class PyApp(gtk.Window): def __init__(self): super(PyApp, self).__init__() self.set_size_request(250, 250) ... (0 Replies)
Discussion started by: LinQ
0 Replies

3. Red Hat

Does the pam_pwdfile module support clear text passwords?

I need to utilize pam_pwdfile in order to authenticate virtual users in vsftpd. I know I can utilize htpasswd2 -m to create a password file however it is vital since I am administrating several machines in our organization that the password generated be in clear text. Does anyone on here know if... (10 Replies)
Discussion started by: colbyshores
10 Replies

4. UNIX for Dummies Questions & Answers

Word Wrap

When I cat a file that has several hundred characters in a line, the right hand side is truncated. How can I make everything displayed on my screen word wrap? (6 Replies)
Discussion started by: bsimon
6 Replies

5. Red Hat

PAM module pam_passwdqc module

Hello friends Today i have changed my passwd policy for strong password Everything is working correctly but when i changed my password , it did not ask me my old password my /etc/pam.d/system-auth file is (only passwdqc.so module line) password required pam_passwdqc.so retry=3... (0 Replies)
Discussion started by: rink
0 Replies

6. UNIX for Dummies Questions & Answers

Sendmail - Disable text wrap

Hi, I am using sendmail to trigger mail alerts. The body of the mail is becoming wrapped in to fit to mail window. I want body to be not wrapped like ' set nowrap 'as in vi editor. ---------- Post updated at 05:35 AM ---------- Previous update was at 04:48 AM ---------- a text of 1000... (1 Reply)
Discussion started by: subramanian2008
1 Replies

7. Shell Programming and Scripting

sed usage with special characters - text manipulation

I'm trying to use sed to replace string in text file but I've some problems with slash and new-line for example I have to replace this string: \> signal_rssi=" or this string where new-line is in the middle of the string: " /> I'm using this code for the first case but it doesn't... (10 Replies)
Discussion started by: TheMrOrange
10 Replies

8. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

9. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

10. Linux

How to convert Linux Kernel built-in module into a loadable module

Hi all, I am working on USB data monitoring on Fedora Core 9. Kernel 2.6.25 has a built-in module (the one that isn't loadable, but compiles and links statically with the kernel during compilation) to snoop USB data. It is in <kernel_source_code>/drivers/usb/mon/. I need to know if I can... (0 Replies)
Discussion started by: anitemp
0 Replies
Login or Register to Ask a Question