Identify the First Column Position in Second Column and add the position value


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Identify the First Column Position in Second Column and add the position value
Prev   Next
# 2  
Old 02-06-2015
Something like this?
Code:
awk -F\| '{NF=3}$1 ~ /[a-zA-Z]/{$3=NR}1' OFS=\| file

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Column to row and position data in a text file

Hi everyone.. I have a list of values in a file... a, b, c, 1, 2, 3, aaaa, bbbbb, I am interested in converting this column to a row.. "text",aaaa, bbbb a,1 (7 Replies)
Discussion started by: manihi
7 Replies

2. Linux

Removing a character at specific position in a column

Hi, I have a file like this (about 8 columns in total, this being the 2nd column) gi_49482297_ref_YP_039521.1_ gi_49482297_ref_YP_039521.1_ gi_49482315_ref_YP_039539.1_ gi_49482315_ref_YP_039539.1_I want to remove the _ at the end of the line. And at later stages I would want to replace the... (5 Replies)
Discussion started by: Syeda Sumayya
5 Replies

3. Shell Programming and Scripting

Need command or script to print all lines from 2nd position to last but one position

hi guys, i want command or script to display the content of file from 2nd position to last but one position of a file abcdefghdasdasdsd 123,345,678,345,323 434,656,656,656,656 678,878,878,989,545 4565656667,65656 i want to display the same above file without first and... (2 Replies)
Discussion started by: hemanthsaikumar
2 Replies

4. Shell Programming and Scripting

Regex to identify word in second position on a line

I am interested in finding a regex to find a word in second position on a line. The word in question is या I tried the following PERL EXPRESSION but it did not work: ] या or ^\W या But both gave Null results I am giving below a Sample file: देना या सौंपना=delegate तह जमना या... (8 Replies)
Discussion started by: gimley
8 Replies

5. Shell Programming and Scripting

Trying to move a column into another position within a sed script

Currently the table looks like this student-id,last,first,hwk1,hwk2,hwk3,exam1,hwk4,hwk5,exam2 pts-avail,,,100,150,100,200,100,150,300 991-78-7872,Thompson,Ken,95,143,79,185,95,135,259 123-45-6789,Richie,Dennis,99,123,89,189,97,139,279 234-56-7891,Aho,Al,78,146,75,176,88,128,285... (3 Replies)
Discussion started by: ertang
3 Replies

6. Shell Programming and Scripting

Find the position of a field/column in a flat file

Hi, Let say I have a file which has around 400 fields. SampleFile ========= PATIENTID|FACILITY|................|TIME_LAST_VISITED_BY_MD|.....|STATUS| How is it possible to find out which field is TIME_LAST_VISITED_BY_MD?fro example by seeing the above structure we can saw FACILITY... (5 Replies)
Discussion started by: machomaddy
5 Replies

7. Shell Programming and Scripting

Identify the position of character

Hi, Can some one guide me to identify the position of a character using index in UNIX. I have a record like "17/11/2010 15:16:39;reject;10.44.48.65;daemon alert; src: 10.44.48.112; dst: 172.21.52.88" . I need to identify the value which comes after _src:_ (_ denotes space). I am able to... (15 Replies)
Discussion started by: suneel.mekala
15 Replies

8. Shell Programming and Scripting

row to column and position data in to fixed column width

Dear friends, Below is my program and current output. I wish to have 3 or 4 column output in order to accomodate in single page. i do have subsequent command to process after user enter the number. Program COUNT=1 for MYDIR in `ls /` do VOBS=${MYDIR} echo "${COUNT}. ${MYDIR}" ... (4 Replies)
Discussion started by: baluchen
4 Replies

9. Shell Programming and Scripting

How to add a column numbers at a particular position?

Problem discription: I have many files which contain the same lines. for instance, (15 lines) file1 ..last column add by hand arbitrarily. 1.78116800 0.68396600 0.00061900 0.47641600 -0.49794500 -0.00024000 -1.70662800 0.29577100 0.67863600 -1.70647600 0.29654600 ... (9 Replies)
Discussion started by: liuzhencc
9 Replies

10. Shell Programming and Scripting

File Manipulation (Move Column Position)

Hi All, I have a comma separated value (.CSV) file like the one below. The file contains about 20000 lines. FileName EmpNo,Name,Age,Sex,Band,Spouse,Children,Salary, 1000,Arnold,24,M,B,N.A.,No,10000, 1001,Jenny,27,F,C,John,2,20000, ................................... What i need is to... (1 Reply)
Discussion started by: ultimate
1 Replies
Login or Register to Ask a Question
Alzabo::Create::Index(3pm)				User Contributed Perl Documentation				Alzabo::Create::Index(3pm)

NAME
Alzabo::Create::Index - Index objects for schema creation SYNOPSIS
use Alzabo::Create::Index; DESCRIPTION
This object represents an index on a table. Indexes consist of columns and optional prefixes for each column. The prefix specifies how many characters of the columns should be indexes (the first X chars). Some RDBMS's do not have a concept of index prefixes. Not all col- umn types are likely to allow prefixes though this depends on the RDBMS. The order of the columns is significant. INHERITS FROM
"Alzabo::Index" Note: all relevant documentation from the superclass has been merged into this document. METHODS
new The constructor takes the following parameters: * table => "Alzabo::Create::Table" object The table that this index is indexing. * columns => [ "Alzabo::Create::Column" object, .. ] * columns => [ { column => "Alzabo::Create::Column" object, prefix => $prefix }, repeat as needed ... ] This parameter indicates which columns that are being indexed. It can either be an array reference of column objects, or an array ref- erence of hash references, each with a key called column and one called prefix. The prefix key is optional. * unique => $boolean Indicates whether or not this is a unique index. * fulltext => $boolean Indicates whether or not this is a fulltext index. * function => $string This can be used to create a function index where supported. The value of this parameter should be the full function, with column names, such as "LCASE( username )". The "columns" parameter should include all the columns used in the function. Returns a new "Alzabo::Create::Index" object. Throws: "Alzabo::Exception::Params", "Alzabo::Exception::RDBMSRules" table Returns the "Alzabo::Create::Table" object to which the index belongs. columns Returns an ordered list of the "Alzabo::Create::Column" objects that are being indexed. add_column Adds a column to the index. This method takes the following parameters: * column => "Alzabo::Create::Column" object * prefix => $prefix (optional) Throws: "Alzabo::Exception::Params", "Alzabo::Exception::RDBMSRules" delete_column ("Alzabo::Create::Column" object) Deletes the given column from the index. Throws: "Alzabo::Exception::Params", "Alzabo::Exception::RDBMSRules" prefix ("Alzabo::Create::Column" object) A column prefix is, to the best of my knowledge, a MySQL specific concept, and as such cannot be set when using an RDBMSRules module for a different RDBMS. However, it is important enough for MySQL to have the functionality be present. It allows you to specify that the index should only look at a certain portion of a field (the first N characters). This prefix is required to index any sort of BLOB column in MySQL. This method returns the prefix for the column in the index. If there is no prefix for this column in the index, then it returns undef. set_prefix This method takes the following parameters: * column => "Alzabo::Create::Column" object * prefix => $prefix Throws: "Alzabo::Exception::Params", "Alzabo::Exception::RDBMSRules" unique Returns a boolean value indicating whether the index is a unique index. set_unique ($boolean) Sets whether or not the index is a unique index. fulltext Returns a boolean value indicating whether the index is a fulltext index. set_fulltext ($boolean) Set whether or not the index is a fulltext index. Throws: "Alzabo::Exception::Params", "Alzabo::Exception::RDBMSRules" register_column_name_change This method takes the following parameters: * column => "Alzabo::Create::Column" object The column (with the new name already set). * old_name => $old_name This method is called by the table object which owns the index when a column name changes. You should never need to call this yourself. Throws: "Alzabo::Exception::Params" id The id is generated from the table, column and prefix information for the index. This is useful as a canonical name for a hash key, for example. Returns a string that is the id which uniquely identifies the index in this schema. AUTHOR
Dave Rolsky, <autarch@urth.org> perl v5.8.8 2007-12-23 Alzabo::Create::Index(3pm)