Sponsored Content
Top Forums UNIX for Advanced & Expert Users Help in Deleting columns and Renaming Mutliple columns in a .Csv File Post 302607763 by mahi_mayu069 on Thursday 15th of March 2012 09:47:08 AM
Old 03-15-2012
Help in Deleting columns and Renaming Mutliple columns in a .Csv File

Hi All,
i have a .Csv file in the below format

Code:
startTime, endTime, delta, gName, rName, rNumber, m2239max, m2239min, m2239avg, m100016509avg, m100019240max, metric3min, m100019240avg, propValues
11-Mar-2012 00:00:00, 11-Mar-2012 00:05:00, 300.0, vma3550a, a-1_CPU Index<1>, 200237463, 0.0, 0.0, 0.0, , , , ,
11-Mar-2012 00:05:00, 11-Mar-2012 00:10:00, 300.0, vma3550a, a-1_CPU Index<1>, 200237463, 0.0, 0.0, 0.0, , , , ,
11-Mar-2012 00:10:00, 11-Mar-2012 00:15:00, 300.0, vma3550a, a-1_CPU Index<1>, 200237463, 0.0, 0.0, 0.0, , , , ,

i want to delete 3rd and 14th field and then the following field headers are to be renamed

Code:
m2239max, m2239min, m2239avg, m100016509avg, m100019240max, metric3min, m100019240avg

My expected file format should be look like this

Code:
startTime, endTime, gName, rName, rNumber, M1max, M1min, M1avg, M2avg, M3max, M3min, M3avg, 
11-Mar-2012 00:00:00, 11-Mar-2012 00:05:00, vma3550a, a-1_CPU Index<1>, 200237463, 0.0, 0.0, 0.0, , , , ,
11-Mar-2012 00:05:00, 11-Mar-2012 00:10:00, vma3550a, a-1_CPU Index<1>, 200237463, 0.0, 0.0, 0.0, , , , ,
11-Mar-2012 00:10:00, 11-Mar-2012 00:15:00, vma3550a, a-1_CPU Index<1>, 200237463, 0.0, 0.0, 0.0, , , , ,

I am newbie to Unix and sed.. Let me know if any inputs required.
This is kinda urgent.

Thanks in Advance,
Mahi

Moderator's Comments:
Mod Comment Please use code tags for program code or text data. Thank you.

Last edited by Corona688; 03-15-2012 at 12:34 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Deleting specific columns from a file

Hi Friends, I want to delete specific columns from a file. Say my file content is as follows: "1","a","ww1",1234" "2","b","wwr3","2222" "3","c","erre","3333" Now i want to delete the column 2 and 4 from this file. That is I want the file content to be: "1","ww1" "2","wwr3"... (11 Replies)
Discussion started by: premar
11 Replies

2. Shell Programming and Scripting

deleting rows & columns form a csv file

Hi , I want to delete some rows & columns from file. can someone please help me on this? Regards. (2 Replies)
Discussion started by: code19
2 Replies

3. Shell Programming and Scripting

no of columns in csv file

Hi, I would like to know how can I find the number of columns in each line in a csv file. I have a csv file wiht comma separated an dhas 10000 line in it. I want to verify the number of columns in each line. is there any way to find it out using awk or any other commands? Thanks.... (2 Replies)
Discussion started by: McLan
2 Replies

4. Shell Programming and Scripting

Deleting columns from CSV file

Hi All, Am working on perl script which should delete columns in existing CSV file. If my file is : AA,BB,CC,DD 00,11,22,33 00,55,66,77 00,99,88,21 AA,BB... are all my headers can come in any order (e.g AA,CC,BB...) and rest are values. I want to delete column CC... Can anybody help... (2 Replies)
Discussion started by: darshakraut
2 Replies

5. Shell Programming and Scripting

Deleting columns by list or file

Dear specialists out there, please help a poor awk newbie: I have a very huge file to process consisting of 300000 columns and 1500 rows. About 20000 columns shall be deleted from that file. So it is clear, that I can't do this by writing down all the columns in an awk command like $1, $x etc.... (5 Replies)
Discussion started by: flxms
5 Replies

6. UNIX for Advanced & Expert Users

Unix Bash: substitute columns in .csv using other .csv columns

Hi All, I have two .csv's input.csv having values as (7 columns) ABC,A19907103,ABC DEV YUNG,2.17,1000,2157,07/07/2006 XYZ,H00213850,MM TRUP HILL,38.38,580,23308,31/08/2010 output.csv having (25 columns) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y... (4 Replies)
Discussion started by: abhivyas
4 Replies

7. Shell Programming and Scripting

Deleting all the fields(columns) from a .csv file if all rows in that columns are blanks

Hi Friends, I have come across some files where some of the columns don not have data. Key, Data1,Data2,Data3,Data4,Data5 A,5,6,,10,, A,3,4,,3,, B,1,,4,5,, B,2,,3,4,, If we see the above data on Data5 column do not have any row got filled. So remove only that column(Here Data5) and... (4 Replies)
Discussion started by: ks_reddy
4 Replies

8. Shell Programming and Scripting

Compare 2 csv files by columns, then extract certain columns of matcing rows

Hi all, I'm pretty much a newbie to UNIX. I would appreciate any help with UNIX coding on comparing two large csv files (greater than 10 GB in size), and output a file with matching columns. I want to compare file1 and file2 by 'id' and 'chain' columns, then extract exact matching rows'... (5 Replies)
Discussion started by: bkane3
5 Replies

9. Shell Programming and Scripting

Match columns from two csv files and update field in one of the csv file

Hi, I have a file of csv data, which looks like this: file1: 1AA,LGV_PONCEY_LES_ATHEE,1,\N,1,00020460E1,0,\N,\N,\N,\N,2,00.22335321,0.00466628 2BB,LES_POUGES_ASF,\N,200,200,00006298G1,0,\N,\N,\N,\N,1,00.30887539,0.00050312... (10 Replies)
Discussion started by: djoseph
10 Replies

10. UNIX for Advanced & Expert Users

Replace columns in .csv using other .csv columns

Hi, I have 2 csv files with 15 000 lines, which looks like this: Daily.csv "CODE","BRAND","DESIGNER","SIZE","TYPE","GENDER","SET","DESCRIPTION","IMAGE","COST","WEIGHT","MSRP","UPC" "M-1001","212","Caroline Her","1.7 oz","EDT... (4 Replies)
Discussion started by: olivieraz
4 Replies
DBM::Deep::Iterator::File::Index(3pm)			User Contributed Perl Documentation		     DBM::Deep::Iterator::File::Index(3pm)

NAME
DBM::Deep::Iterator::Index - mediate between DBM::Deep::Iterator and DBM::Deep::Engine::Sector::Index PURPOSE
This is an internal-use-only object for DBM::Deep. It acts as the mediator between the DBM::Deep::Iterator object and a DBM::Deep::Engine::Sector::Index sector. OVERVIEW
This object, despite the implied class hiearchy, does NOT inherit from DBM::Deep::Iterator. Instead, it delegates to it, essentially acting as a facade over it. "get_next_key" in DBM::Deep::Iterator will instantiate one of these objects as needed to handle an Index sector. METHODS
new(\%params) The constructor takes a hashref of params and blesses it into the invoking class. The hashref is assumed to have the following elements: o iterator (of type DBM::Deep::Iterator o sector (of type DBM::Deep::Engine::Sector::Index at_end() This takes no arguments. This returns true/false indicating whether this sector has any more elements that can be iterated over. get_next_iterator() This takes no arguments. This returns an iterator (built by "get_sector_iterator" in DBM::Deep::Iterator) based on the sector pointed to by the next occupied location in this index. If the sector is exhausted, it returns nothing. perl v5.14.2 2012-06-24 DBM::Deep::Iterator::File::Index(3pm)
All times are GMT -4. The time now is 03:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy