Now if I want to limit no. of characters in first columns to somevalue and if it exceeds that many characters then it should go to next line.. how can i do that?
like
the value in the 5,6,10,11 rows in the first column is writted in 2 lines... appreciate your help thank you
Hello Gurus,
I have a text file containing nearly 12,000 tab delimited characters with 4000 rows. If the file size is small, excel can convert the text into coloumns. However, the file that I have is very big. Can some body help me in solving this problem?
The input file example,
... (6 Replies)
Hello,
Is there anyway that I can align a pipe delimited text file by the maxium field length where the field is separated out by pipes for large text files with more than
100,000 rows?
So, far I have searched other forums and google about aligning text files in unix and I have noticed that... (7 Replies)
Hi All,
I have two sets of files with names .dat and .txt. The number of files is really large more than 90000. The files have names like 1.dat, 2.dat,3.dat and so on where as txt files have names like 1.txt, 2.txt, 3.txt and so on
The DAT and TXT files are equal in number. About 90000 each
... (4 Replies)
I have a text file that has three columns. But at the end of the text file, there are trailing lines that have missing second and third columns:
4 0.04972604 KLHL28
4 0.0497332 CSTB
4 0.04979822 AIF1
4 0.04983331 DECR2
4 0.04990344 KATNB1
4
4
4
4
How can I remove the trailing... (3 Replies)
I have a file in which I need to add more columns to based on a key in the first file:
File1
key1,abc,123,
key2,def,456,
key3,ghi,789,
File2
key2,zyx,111,qqq,
key3,yuu,222,www,
key1,pui,333,eee,
key4,xxx,999,rrr,
I would like to create the following output:
Output (1 Reply)
Hello friends
Please help me to display the content of a file in specific aligned manner.
for ex.
the content of the file may be
>$TEST
WELCOME
HI
HELLO
UNIX
SHELL
SCRIPTING
>$
I want to display the content like
.
TEST WELCOME HI
HELLO ... (18 Replies)
Hi all,
I have 2 files:
species-names.txt
Abaca-bunchy-top-virus ((((Abaca-bunchy-top-virus((Babuvirus((Unassigned((Nanoviridae((Unassigned))))
Abutilon-mosaic-virus ((((Abutilon-mosaic-virus((Begomovirus((Unassigned((Geminiviridae((Unassigned))))... (2 Replies)
Hello,
I want to concatenate 2-columns by 2-columns separated by colon. How can I do so? For example, I have a text file containing 6 columns separated by tab. I want to concatenate column 1 and 2; column 3 and 4; column 5 and 6, respectively, and put a colon in between.
input file:
1 0 0 1... (10 Replies)
Dear all,
Pzl let me know what is the syntax for converting the columns format to text as i have lots of values for but when i put these values in xls sheet the values are automatically converted to
and one more question i have is how to call values from shell script into perl script
eg.
... (3 Replies)
I have a large text file in following format
cat input.txt
abc
qwert
qwer
afweferf
wdfwefwe ==> kjhjkwdd
mnmn ==> jkjkjwekj
poiu ==> lklklke
tytyutut ==> olkjmnsmn
I need to align those lines with the characters " ==>" . I dont want to disturb the lines which dont have "==>".
The... (6 Replies)
Discussion started by: ctrld
6 Replies
LEARN ABOUT REDHAT
text::wrap
Text::Wrap(3pm) Perl Programmers Reference Guide Text::Wrap(3pm)NAME
Text::Wrap - line wrapping to form simple paragraphs
SYNOPSIS
Example 1
use Text::Wrap
$initial_tab = " "; # Tab before first line
$subsequent_tab = ""; # All other lines flush left
print wrap($initial_tab, $subsequent_tab, @text);
print fill($initial_tab, $subsequent_tab, @text);
@lines = wrap($initial_tab, $subsequent_tab, @text);
@paragraphs = fill($initial_tab, $subsequent_tab, @text);
Example 2
use Text::Wrap qw(wrap $columns $huge);
$columns = 132; # Wrap at 132 characters
$huge = 'die';
$huge = 'wrap';
$huge = 'overflow';
Example 3
use Text::Wrap
$Text::Wrap::columns = 72;
print wrap('', '', @text);
DESCRIPTION
"Text::Wrap::wrap()" is a very simple paragraph formatter. It formats a single paragraph at a time by breaking lines at word boundries.
Indentation is controlled for the first line ($initial_tab) and all subsequent lines ($subsequent_tab) independently. Please note: $ini-
tial_tab and $subsequent_tab are the literal strings that will be used: it is unlikley you would want to pass in a number.
Text::Wrap::fill() is a simple multi-paragraph formatter. It formats each paragraph separately and then joins them together when it's
done. It will destory any whitespace in the original text. It breaks text into paragraphs by looking for whitespace after a newline. In
other respects it acts like wrap().
OVERRIDES
"Text::Wrap::wrap()" has a number of variables that control its behavior. Because other modules might be using "Text::Wrap::wrap()" it is
suggested that you leave these variables alone! If you can't do that, then use "local($Text::Wrap::VARIABLE) = YOURVALUE" when you change
the values so that the original value is restored. This "local()" trick will not work if you import the variable into your own namespace.
Lines are wrapped at $Text::Wrap::columns columns. $Text::Wrap::columns should be set to the full width of your output device. In fact,
every resulting line will have length of no more than "$columns - 1".
It is possible to control which characters terminate words by modifying $Text::Wrap::break. Set this to a string such as '[s:]' (to break
before spaces or colons) or a pre-compiled regexp such as "qr/[s']/" (to break before spaces or apostrophes). The default is simply 's';
that is, words are terminated by spaces. (This means, among other things, that trailing punctuation such as full stops or commas stay
with the word they are "attached" to.)
Beginner note: In example 2, above $columns is imported into the local namespace, and set locally. In example 3, $Text::Wrap::columns is
set in its own namespace without importing it.
"Text::Wrap::wrap()" starts its work by expanding all the tabs in its input into spaces. The last thing it does it to turn spaces back
into tabs. If you do not want tabs in your results, set $Text::Wrap::unexapand to a false value. Likewise if you do not want to use
8-character tabstops, set $Text::Wrap::tabstop to the number of characters you do want for your tabstops.
If you want to separate your lines with something other than "
" then set $Text::Wrap::seporator to your preference.
When words that are longer than $columns are encountered, they are broken up. "wrap()" adds a "
" at column $columns. This behavior can
be overridden by setting $huge to 'die' or to 'overflow'. When set to 'die', large words will cause "die()" to be called. When set to
'overflow', large words will be left intact.
Historical notes: 'die' used to be the default value of $huge. Now, 'wrap' is the default value.
EXAMPLE
print wrap(" ","","This is a bit of text that forms
a normal book-style paragraph");
AUTHOR
David Muir Sharnoff <muir@idiom.com> with help from Tim Pierce and many many others.
perl v5.8.0 2002-06-01 Text::Wrap(3pm)