Sponsored Content
Full Discussion: Swapping column in vi editor
Top Forums UNIX for Dummies Questions & Answers Swapping column in vi editor Post 302732671 by guruprasadpr on Monday 19th of November 2012 01:44:34 AM
Old 11-19-2012
Hi

Something like this:

Code:
:%s/\([^ ]*\) *\([^ ]*\)/\2 \1 /


Last edited by guruprasadpr; 11-19-2012 at 03:59 AM.. Reason: Removed g to prevent global substitution
 

10 More Discussions You Might Find Interesting

1. SuSE

Swapping

Hello! Why does my SuSE GNU/Linux machine swap? I have a Gig of ram, currently 14MBs of free RAM, 724MB - buffers and caches... That is 685MB of cached RAM, then kernel really should'nt have to swap, It should release cached memory in my thinkin... It has only swaped 3MB's but still,... (3 Replies)
Discussion started by: Esaia
3 Replies

2. UNIX for Dummies Questions & Answers

Pasting text in VI editor from a different editor

Hi, I knw its a silly question, but am a newbie to 'vi' editor. I'm forced to use this, hence kindly help me with this question. How can i paste a chunk 'copied from' a different editor(gedit) in 'vi editor'? As i see, p & P options does work only within 'vi'. (10 Replies)
Discussion started by: harishmitty
10 Replies

3. Shell Programming and Scripting

set EDITOR=vi -> default editor not setting for cron tab

Hi All, I am running a script , working very fine on cmd prompt. The problem is that when I open do crontab -e even after setting editor to vi by set EDITOR=vi it does not open a vi editor , rather it do as below..... ///////////////////////////////////////////////////// $ set... (6 Replies)
Discussion started by: aarora_98
6 Replies

4. Shell Programming and Scripting

VI editor,column postion

In VI editor ctrl + g is used indicate the line number on which the cursor is placed...similarly is there a way to determine the column number of the cursor position..? (1 Reply)
Discussion started by: vijay_0209
1 Replies

5. UNIX for Dummies Questions & Answers

Swapping in VI editor

Hi, I am attempting to replace several similar words with another word in vi. Here is what I have written for the script: 3dTcat -prefix SuperBrik_4WAY_HRF ../JULY10_2007A/results2TENT/stats.JULY10_2007A+tlrc ../JULY10_2007G/results2TENT/stats.JULY10_2007G+tlrc... (1 Reply)
Discussion started by: Jahn
1 Replies

6. Shell Programming and Scripting

Vi editor, copy one column?

This is an vi editor question. I do not know is this a right place to ask this question or not? I have a file with the following contents, 10 11 20 21 30 31 I want to copy first column that is 10,20,30 after second column, so that output will look like the following, 10 11 10 20 21 20... (3 Replies)
Discussion started by: MeetP
3 Replies

7. Solaris

How to set VI editor column size on Solaris?

I am setting the size using "stty columns 120" . But I still get the prompt saying "terminal too wide " when I am in vi. is there any time limit for this setting? how to set the column size to 120 permanently? Thanks in advance, Devi (4 Replies)
Discussion started by: pvkdevi
4 Replies

8. UNIX for Dummies Questions & Answers

Delete a specific column using vi editor?

Hello Experts, I'm a newbie so please excuse any wrong doings. I have a file that looks like this. abc def ghi jkl mno def abc ghi mno jkl ghi def mno jkl abc I would like the file to look like this abc def ghi jklmno def abc ghi mnojkl ghi def mno jklabc in other... (3 Replies)
Discussion started by: fnebiolo
3 Replies

9. UNIX for Dummies Questions & Answers

Removing 2nd Column in Vi Editor

I have text like this M83-306 132 797 M83-312 145 685 M83-315 321 479 M83-319 654 193 M83-350 556 1184 M83-303 222 199 and I want to make it like this M83-306 797 M83-312 685 M83-315 ... (9 Replies)
Discussion started by: muhnandap
9 Replies

10. UNIX for Dummies Questions & Answers

Remove a column using vi editor

How do i remove a column using vi editor Assuming the file to be of format 1: 010 0xad45 sp1 - 11:29:51.498583949 500249144 Event1 rst bcfe jhv rgc 456: 010 0xadb sp2 - 11:29:51.498600605 4464 Event0abcrd adabc aasd 45: 010 0x10 sp0 - 11:29:51.498614165 13560 Back adxca... (6 Replies)
Discussion started by: sp0
6 Replies
funtbl(1)							SAORD Documentation							 funtbl(1)

NAME
funtbl - extract a table from Funtools ASCII output SYNOPSIS
funtable [-c cols] [-h] [-n table] [-p prog] [-s sep] <iname> DESCRIPTION
[NB: This program has been deprecated in favor of the ASCII text processing support in funtools. You can now perform fundisp on funtools ASCII output files (specifying the table using bracket notation) to extract tables and columns.] The funtbl script extracts a specified table (without the header and comments) from a funtools ASCII output file and writes the result to the standard output. The first non-switch argument is the ASCII input file name (i.e. the saved output from funcnts, fundisp, funhist, etc.). If no filename is specified, stdin is read. The -n switch specifies which table (starting from 1) to extract. The default is to extract the first table. The -c switch is a space-delimited list of column numbers to output, e.g. -c "1 3 5" will extract the first three odd-numbered columns. The default is to extract all columns. The -s switch specifies the separator string to put between columns. The default is a single space. The -h switch specifies that column names should be added in a header line before the data is output. With- out the switch, no header is prepended. The -p program switch allows you to specify an awk-like program to run instead of the default (which is host-specific and is determined at build time). The -T switch will output the data in rdb format (i.e., with a 2-row header of column names and dashes, and with data columns separated by tabs). The -help switch will print out a message describing program usage. For example, consider the output from the following funcnts command: [sh] funcnts -sr snr.ev "ann 512 512 0 9 n=3" # source # data file: /proj/rd/data/snr.ev # arcsec/pixel: 8 # background # constant value: 0.000000 # column units # area: arcsec**2 # surf_bri: cnts/arcsec**2 # surf_err: cnts/arcsec**2 # summed background-subtracted results upto net_counts error background berror area surf_bri surf_err ---- ------------ --------- ------------ --------- --------- --------- --------- 1 147.000 12.124 0.000 0.000 1600.00 0.092 0.008 2 625.000 25.000 0.000 0.000 6976.00 0.090 0.004 3 1442.000 37.974 0.000 0.000 15936.00 0.090 0.002 # background-subtracted results reg net_counts error background berror area surf_bri surf_err ---- ------------ --------- ------------ --------- --------- --------- --------- 1 147.000 12.124 0.000 0.000 1600.00 0.092 0.008 2 478.000 21.863 0.000 0.000 5376.00 0.089 0.004 3 817.000 28.583 0.000 0.000 8960.00 0.091 0.003 # the following source and background components were used: source_region(s) ---------------- ann 512 512 0 9 n=3 reg counts pixels sumcnts sumpix ---- ------------ --------- ------------ --------- 1 147.000 25 147.000 25 2 478.000 84 625.000 109 3 817.000 140 1442.000 249 There are four tables in this output. To extract the last one, you can execute: [sh] funcnts -s snr.ev "ann 512 512 0 9 n=3" | funtbl -n 4 1 147.000 25 147.000 25 2 478.000 84 625.000 109 3 817.000 140 1442.000 249 Note that the output has been re-formatted so that only a single space separates each column, with no extraneous header or comment informa- tion. To extract only columns 1,2, and 4 from the last example (but with a header prepended and tabs between columns), you can execute: [sh] funcnts -s snr.ev "ann 512 512 0 9 n=3" | funtbl -c "1 2 4" -h -n 4 -s " " #reg counts sumcnts 1 147.000 147.000 2 478.000 625.000 3 817.000 1442.000 Of course, if the output has previously been saved in a file named foo.out, the same result can be obtained by executing: [sh] funtbl -c "1 2 4" -h -n 4 -s " " foo.out #reg counts sumcnts 1 147.000 147.000 2 478.000 625.000 3 817.000 1442.000 SEE ALSO
See funtools(7) for a list of Funtools help pages version 1.4.2 January 2, 2008 funtbl(1)
All times are GMT -4. The time now is 10:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy