Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Vi - insert a tab between words? Post 302742833 by Yoda on Tuesday 11th of December 2012 03:57:06 PM
Old 12-11-2012
Run below in VI command mode:-
Code:
:%s/Jones /Jones[tab]/g

Note: press key: Tab (highlighted) after string: Jones for replacement.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert TAB in echo statement

Hi, Can some1 help me to output a tab in an echo statement. I have tried echo "RNC: \t NODEB" but dont get the correct output. I am a beginnger to unix, so pls hold back the laughs....if u can (5 Replies)
Discussion started by: sunils27
5 Replies

2. Shell Programming and Scripting

pls help me to insert tab and formatthe file

i want to format the file with tab delimitaed and assign heading to each column . my format of file is 7 aiss 10 8 linux 25 9 linux_10for 35 Ouput i want like this Ver Host Fails 7 aiss 10 8 linux 25 9 ... (5 Replies)
Discussion started by: getdpg
5 Replies

3. UNIX for Dummies Questions & Answers

How to insert tab at specified column.HELP

I have input like: 1234567890 cut -c1-3,6-7,9-10 input > output Now I got 1236790. I want to insert space between each cut. So the output like: 123 67 90 Can anybody help? Thanks. (7 Replies)
Discussion started by: sslr
7 Replies

4. Shell Programming and Scripting

sed: how to insert tab?

Hi, I'm using the following to insert lines into file: sed ${rowNr}i'\ first row\ second row\ third row\ ' file.txt How can I add tab in front of each added line? "\t" or actual TAB does not seem to work? Thanks! (2 Replies)
Discussion started by: Juha
2 Replies

5. Shell Programming and Scripting

insert a field into a tab delimited file

Hello, Can someone help me to do this with awk or sed? I have a file with multiple lines, each line has many fields separated with a tab. I would like to add one more field holding 'na' in between the first and second fields. old file looks like, 1, field1 field2 field3 ... 2, field1... (7 Replies)
Discussion started by: ssshen
7 Replies

6. UNIX for Dummies Questions & Answers

Insert Field into a tab-delimited file

Hello, I have about 100 files in a directory with fields which are tab delimited. I would like to append the file name as the first field and it has to be done as many times as the total lines in the file. For example, myFile1.txt has the following data: 1 x y z 2 a b ... (5 Replies)
Discussion started by: Gussifinknottle
5 Replies

7. Shell Programming and Scripting

insert LF and TAB for formatting

trying to insert a LF and 2 TABs for this: sed 's/<td><\/td>/<td>\n\t\t<\/td>/' infile. but, I'm not getting the syntax for inserting the LF and TABs correct (1 Reply)
Discussion started by: dba_frog
1 Replies

8. UNIX for Dummies Questions & Answers

insert whitespace (tab) at start of each line

Hi all, I have this: begin data; dimensions nind=168 nloci=6; info BDT001.4 ( 1 , 1 ) ( 1 , 12 ) BDT003.4 ( 1 , 1 ) ( 12 , 12 ) BDT007.4 ( 1 , 1 ) ( 12 , 12 ) BDT009.4 ( 1 , 32 ) ( 12 , 22 ) etc, etc And need this: begin data; dimensions nind=168 nloci=6; info ... (2 Replies)
Discussion started by: MDeBiasse
2 Replies

9. Shell Programming and Scripting

Problem while assign string (words with tab) to a variable

Hi, I have a String(words with tab space) in a file ->file1.txt 0xxxx 11 test $aa$ 8.43 when i read the file and assign to variable value=$(cat file1.txt) echo $value i get the output without tab spaces. 0xxxx 11 test $aa$ 8.43 How to assign string... (2 Replies)
Discussion started by: nanthagopal
2 Replies

10. Shell Programming and Scripting

Delete and insert columns in a tab delimited file

Hi all , I have a file having 12 columns tab delimited . I need to read this file and remove the column 3 and column 4 and insert a word in column 3 as "AVIALABLE " Is there a way to do this . I am trying like below Thanks DJ cat $FILENAME|awk -F"\t" '{ print $1 "\t... (3 Replies)
Discussion started by: Hypesslearner
3 Replies
TabularDisplay(3pm)					User Contributed Perl Documentation				       TabularDisplay(3pm)

NAME
Text::TabularDisplay - Display text in formatted table output SYNOPSIS
use Text::TabularDisplay; my $table = Text::TabularDisplay->new(@columns); $table->add(@row) while (@row = $sth->fetchrow); print $table->render; +----+--------------+ | id | name | +----+--------------+ | 1 | Tom | | 2 | Dick | | 3 | Barry | | | (aka Bazza) | | 4 | Harry | +----+--------------+ DESCRIPTION
Text::TabularDisplay simplifies displaying textual data in a table. The output is identical to the columnar display of query results in the mysql text monitor. For example, this data: 1, "Tom Jones", "(666) 555-1212" 2, "Barnaby Jones", "(666) 555-1213" 3, "Bridget Jones", "(666) 555-1214" Used like so: my $t = Text::TabularDisplay->new(qw(id name phone)); $t->add(1, "Tom Jones", "(666) 555-1212"); $t->add(2, "Barnaby Jones", "(666) 555-1213"); $t->add(3, "Bridget Jones", "(666) 555-1214"); print $t->render; Produces: +----+---------------+----------------+ | id | name | phone | +----+---------------+----------------+ | 1 | Tom Jones | (666) 555-1212 | | 2 | Barnaby Jones | (666) 555-1213 | | 3 | Bridget Jones | (666) 555-1214 | +----+---------------+----------------+ METHODS
Text::TabularDisplay has four primary methods: new(), columns(), add(), and render(). new() creates a new Text::TabularDisplay instance; columns() sets the column headers in the output table; add() adds data to the instance; and render() returns a formatted string representation of the instance. There are also a few auxiliary convenience methods: clone(), items(), reset(), populate(), and paginate(). new A Text::TabularDisplay instance can be created with column names passed as constructor args, so these two calls produce similar objects: my $t1 = Text::TabularDisplay->new; $t1->columns(qw< one two >); my $t2 = Text::TabularDisplay->new(qw< one two >); Calling new() on a Text::TabularDisplay instance returns a clone of the object. See "clone" in Text::TabularDisplay. columns Gets or sets the column names for an instance. This method is called automatically by the constructor with any parameters that are passed to the constructor (if any are passed). When called in scalar context, columns() returns the number of columns in the instance, rather than the columns themselves. In list context, copies of the columns names are returned; the names of the columns cannot be modified this way. add Takes a list of items and appends it to the list of items to be displayed. add() can also take a reference to an array, so that large arrays don't need to be copied. As elements are processed, add() maintains the width of each column so that the resulting table has the correct dimensions. add() returns $self, so that calls to add() can be chained: $t->add(@one)->add(@two)->add(@three); render render() does most of the actual work. It returns a string containing the data added via add(), formatted as a table, with a header containing the column names. render() does not change the state of the object; it can be called multiple times, with identical output (including identical running time: the output of render is not cached). If there are no columns defined, then the output table does not contains a row of column names. Compare these two sequences: my $t = Text::TabularDisplay->new; $t->add(qw< 1 2 3 4 >); $t->add(qw< 5 6 7 8 >); print $t->render; $t->columns(qw< one two three four >); print $t->render; # Example 1 output +---+---+---+---+ | 1 | 2 | 3 | 4 | | 5 | 6 | 7 | 8 | +---+---+---+---+ # Example 2 output +-----+-----+-------+------+ | one | two | three | four | +-----+-----+-------+------+ | 1 | 2 | 3 | 4 | | 5 | 6 | 7 | 8 | +-----+-----+-------+------+ render() takes optional $start and $end arguments; these indicate the start and end indexes for the data to be rendered. This can be used for paging and the like: $t->add(1, 2, 3)->add(4, 5, 6)->add(7, 8, 9)->add(10, 11, 12); print $t->render(0, 1), " "; print $t->render(2, 3), " "; Produces: +-------+--------+-------+ | First | Second | Third | +-------+--------+-------+ | 1 | 2 | 3 | | 4 | 5 | 6 | +-------+--------+-------+ +-------+--------+-------+ | First | Second | Third | +-------+--------+-------+ | 7 | 8 | 9 | | 10 | 11 | 12 | +-------+--------+-------+ As an aside, note the chaining of calls to add(). The elements in the table are padded such that there is the same number of items in each row, including the header. Thus: $t->columns(qw< One Two >); print $t->render; +-----+-----+----+ | One | Two | | +-----+-----+----+ | 1 | 2 | 3 | | 4 | 5 | 6 | | 7 | 8 | 9 | | 10 | 11 | 12 | +-----+-----+----+ And: $t->columns(qw< One Two Three Four>); print $t->render; +-----+-----+-------+------+ | One | Two | Three | Four | +-----+-----+-------+------+ | 1 | 2 | 3 | | | 4 | 5 | 6 | | | 7 | 8 | 9 | | | 10 | 11 | 12 | | +-----+-----+-------+------+ OTHER METHODS
clone() The clone() method returns an identical copy of a Text::TabularDisplay instance, completely separate from the cloned instance. items() The items() method returns the number of elements currently stored in the data structure: printf "There are %d elements in $t. ", $t->items; reset() Reset deletes the data from the instance, including columns. If passed arguments, it passes them to columns(), just like new(). populate() populate() as a special case of add(); populate() expects a reference to an array of references to arrays, such as returned by DBI's selectall_arrayref method: $sql = "SELECT " . join(", ", @c) . " FROM mytable"; $t->columns(@c); $t->populate($dbh->selectall_arrayref($sql)); This is for convenience only; the implementation maps this to multiple calls to add(). NOTES
/ ISSUES Text::TabularDisplay assumes it is handling strings, and does stringy things with the data, like length() and sprintf(). Non-character data can be passed in, of course, but will be treated as strings; this may have ramifications for objects that implement overloading. The biggest issue, though, is that this module duplicates a some of the functionality of Data::ShowTable. Of course, Data::ShowTable is a large, complex monolithic tool that does a lot of things, while Text::TabularDisplay is small and fast. AUTHOR
darren chamberlain <darren@cpan.org> CREDITS
The following people have contributed patches, suggestions, tests, feedback, or good karma: David N. Blank-Edelman Eric Cholet Ken Youens-Clark Michael Fowler Paul Cameron Prakash Kailasa Slaven Rezic Harlan Lieberman-Berg Patrick Kuijvenhoven VERSION
This documentation describes "Text::TabularDisplay" version 1.33. perl v5.14.2 2012-07-05 TabularDisplay(3pm)
All times are GMT -4. The time now is 11:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy