![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| word wrap issue with grep | bowtiextreme | HP-UX | 4 | 04-30-2008 07:39 PM |
| SCO acquisition wrap-up | iBot | UNIX and Linux RSS News | 0 | 02-19-2008 05:30 PM |
| Wrap Interactive Script | meskue | Shell Programming and Scripting | 0 | 06-23-2006 06:21 PM |
| Should I use sed/ grep/awk for wrap file? | vanda_25 | Shell Programming and Scripting | 6 | 05-04-2006 12:59 PM |
| word wrap in vi | dangral | UNIX for Dummies Questions & Answers | 3 | 10-30-2002 02:45 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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);
thx |
|
||||
|
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?)
|
|
||||
|
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 02:11 AM.. Reason: Add example output |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| linux, ubuntu |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|