Vi. changing txt into table


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Vi. changing txt into table
# 1  
Old 10-06-2015
Vi. changing txt into table

just discover this thread. It sounds perfect for me because I am following an online course on command line tools and some instruction ... seems not be replicable on my Terminal

Here is an example on a txt file with n rows each containing 3 word separated by a space.

a b c
d e f
....

after entering in the vi editor what I want is to convert the file into a tabular structure.
The command provided is
:1,$s/ / ^I/g

on the opposite to what the instructor got (table) mine is just
a ^Ib ^Ic
d ^Ie ^If
...

can anyone help or saying if it is possible that is the terminal that misinterpreted the command?

Thanks a lot
# 2  
Old 10-06-2015
In this case the ^I was meant to be inserted by pressing the TAB key on your keyboard. The caret symbol often denotes a control code achieved by holding down control and pressing the next letter.
This User Gave Thanks to neutronscott For This Post:
# 3  
Old 10-06-2015
Quote:
Originally Posted by neutronscott
In this case the ^I was meant to be inserted by pressing the TAB key on your keyboard. The caret symbol often denotes a control code achieved by holding down control and pressing the next letter.
This is not the case because this is the exact synthax the instructor typed on its terminal when in file editing mode and not what I was said to do. This is to say that I just copied what I saw on the screen
# 4  
Old 10-06-2015
Have you tried it? If you press a tab while typing that command out, Vim will display a ^I to the screen but afterwards your file will be tabulated.
# 5  
Old 10-06-2015
Hi,
To obtain ^I under vim in normal mode by key series below:
CTRL+v and TAB key. So for your example, type in normal mode:
Code:
:1,$s/ / <CTRL>v<TAB>/g

Regards.
# 6  
Old 10-06-2015
I got it.
Pressing the tab results in "^I" in the text
but writing it down and obtaining apparently the very same code it is not the same at all.
Now I understand why the color of "^I" is blue!!
thanks
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk, sed, shell all words in INPUT.txt find in column1 of TABLE.txt and replce with column2 in

Hi dears i have text file like this: INPUT.txt 001_1_173 j nuh ]az 001_1_174 j ]esma. nuh ]/.xori . . . and have another text like this TABLE.txt j j nuh word1... (6 Replies)
Discussion started by: alii
6 Replies

2. UNIX for Dummies Questions & Answers

Convert Txt file to HTML table and email

Hi all I need help converting a text file into a html table in bash and I need to email this table. The text file looks like the below. Two columns with multiple rows. Top row being header. Application Name Application Status Application 1 Open Application 2 ... (2 Replies)
Discussion started by: hitmanjd
2 Replies

3. OS X (Apple)

Changing txt files to pure UTF-8

I have two Macs running 10.7.5. We download .txt files from remote site to these local Macs using 'rsync -e ssh -avz...'. The files on Mac1 are in the required format of pure UTF-8. The files on Mac2 are in UTF-8 (no BOM) which is wrong format for us; these formats are indicated using BBEdit.... (1 Reply)
Discussion started by: sovdia
1 Replies

4. Shell Programming and Scripting

Changing Line in Txt File

So I have a python program that I run, which runs accordingly to options I have listed in a text file (ie user_prefs). Now there are many options listed in this user_prefs.txt, but the one of most interest to me is that of the file path of the time series. I have over a hundred of these time... (8 Replies)
Discussion started by: Jimmyd24
8 Replies

5. UNIX for Dummies Questions & Answers

Changing table layout

Hi everyone, I'm a beginner in Unix, and would need some help from you guys! My input (pipe delimited): City|ZIP|Ref. Item NYC|212|00004 NYC|212|00032 NYC|212|00006 LA|90049|00068 LA|90049|00009 SF|94131|0027 You can see that the first 3 lines have column 1 and 2 in common, same for... (8 Replies)
Discussion started by: beca123456
8 Replies

6. UNIX for Dummies Questions & Answers

How to Update DB table from txt file using CRONJOB in Unix Shell Script

Hi Experts, can guide how we can Update a Database Table using a txt file source Using Unix Shell Scripts. What are the Cron Jobs codes can written to Update DB table. txt file contains record like data. US 09/03/2012 User DocType DocID. these above feilds in txt files need to be updated in... (4 Replies)
Discussion started by: mahesh.sap
4 Replies

7. Shell Programming and Scripting

Convert shell script output txt file to html table

Hi, I have script which generates the output as below: Jobname Date Time Status abc 12/9/11 17:00 Completed xyz 13/9/11 21:00 Running I have the output as a text file. I need to convert it into a HTML Table and sent it thru email ... (6 Replies)
Discussion started by: a12ka4
6 Replies

8. Shell Programming and Scripting

Export data from DB2 table to .txt file(space delimited)

Hi I need help on this. Its very urgent for me.. please try to help me out.. I have data in tables in DB2 database. I would like to export the data from DB2 tables into a text file, which has to be space delimited. so that I can carry out awk, grep operations on that file. I tried to export... (2 Replies)
Discussion started by: ss3944
2 Replies

9. Shell Programming and Scripting

Format txt file as html table

I have a short time to solve a problem, so I need some help. I've searched the forum, but I couldn't find a solution to my problem. I made a script to filter some text and now I have a new requirement to make it available as html table. Problem is that I more than one files with different set... (2 Replies)
Discussion started by: tetreb
2 Replies

10. Shell Programming and Scripting

Changing txt

Hi all, I currently use this code to delete text from file names when they are dropped in a folder. find . -type f | while read i;do && mv "$i" "${i//2009abc/}" ;done I have four versions of the code that delete the unwanted text if it has 2006, 2007, 2008 and 2009 with other standard... (4 Replies)
Discussion started by: Monkey Dean
4 Replies
Login or Register to Ask a Question