Sponsored Content
Top Forums Shell Programming and Scripting Perl code to grep a particular column in CSV format Post 302718927 by Yoda on Sunday 21st of October 2012 12:41:59 PM
Old 10-21-2012
elixir_sinari, I really appreciate your suggestion.

Correction:-

Code:
awk -F, '!/unix/ && !/Event/  { print $7 "," $8 } ' new.csv | while IFS="," read event_date create_date


Last edited by Yoda; 10-21-2012 at 02:21 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

AWK CSV to TXT format, TXT file not in a correct column format

HI guys, I have created a script to read 1 column in a csv file and then place it in text file. However, when i checked out the text file, it is not in a column format... Example: CSV file contains name,age aa,11 bb,22 cc,33 After using awk to get first column TXT file... (1 Reply)
Discussion started by: mdap
1 Replies

2. Shell Programming and Scripting

convert files into csv format using perl

Hi all perl gurus, I need your help to get the desired output in perl. I have a file which has text in it in the format Connection request start timestamp = 12/08/2008 00:58:36.956700 Connect request completion timestamp = 12/08/2008 00:58:36.959729 Application idle time ... (10 Replies)
Discussion started by: azs0309
10 Replies

3. UNIX for Dummies Questions & Answers

Option in sql script to include column headers when spooling file to .csv format

Can anyone help me how to include COLUMN HEADER when spooling file to .CSV format through SQL statement. Thanks, Akbar (4 Replies)
Discussion started by: s1a2m3
4 Replies

4. Shell Programming and Scripting

return a list of unique values of a column from csv format file

Hi all, I have a huge csv file with the following format of data, Num SNPs, 549997 Total SNPs,555352 Num Samples, 157 SNP, SampleID, Allele1, Allele2 A001,AB1,A,A A002,AB1,A,A A003,AB1,A,A ... ... ... I would like to write out a list of unique SNP (column 1). Could you... (3 Replies)
Discussion started by: phoeberunner
3 Replies

5. Shell Programming and Scripting

Format text to bold from perl script to csv

Hi everyone, is there any way in perl using which we can print the selective words in bold when we write the output to a csv file? Please find the example below 1. Filename: A 2. name age 12 3. city add 23 Line1 should only be bold. Outputs from other files being read in the... (2 Replies)
Discussion started by: ramakanth_burra
2 Replies

6. UNIX for Dummies Questions & Answers

How to extract one column from csv file in perl?

Hi everyone, i am new to perl programming, i have a problem in extracting single column from csv file. the column is the 20th column, please help me.. at present i use this code #!C:/perl/bin use warnings; use strict; my $file1 = $ARGV; open FILE1, "<$file1" or die "Can't... (13 Replies)
Discussion started by: kvth
13 Replies

7. Shell Programming and Scripting

Script to Grep column 3 from csv file generated yesterday

Hello, Can any one please assist how to scirpt it: Every day a new log file is create and I want to process only the one generated yesterday and get the data of column 3 and 6. For example today's date is 24 then I want to get the data of log file created on 23rd. Log Files in... (7 Replies)
Discussion started by: sureshcisco
7 Replies

8. Shell Programming and Scripting

3 column .csv --> correlation matrix; awk, perl?

Greetings, salutations. I have a 3 column csv file with ~13 million rows and I would like to generate a correlation matrix. Interestingly, you all previously provided a solution to the inverse of this problem. Thread title: "awk? adjacency matrix to adjacency list / correlation matrix to list"... (6 Replies)
Discussion started by: R3353
6 Replies

9. Shell Programming and Scripting

Need perl or shell script to sort vertical lines to horizontal line in csv format

Need perl or shell script to sort vertical lines to horizontal line in csv format My file like below ------------------------- ================================================================================ PATH PINKY1000#I1-1-ZENTA1000-2#I7-1-ASON-SBR-UP-943113845 ... (4 Replies)
Discussion started by: sreedhargouda.h
4 Replies

10. Programming

Python or Shell script to Grep strings from input file and output in csv format

Hi Experts, I am writing a python script to grep string from file and display output in csv file as in attached screenshot https://drive.google.com/file/d/1gfUUdfmQma33tz65NskThYDhkZUGQO0H/view Input file(result_EPFT_config_device) Below is the python script i have prepared as of... (1 Reply)
Discussion started by: as7951
1 Replies
TM::Serializable::CSV(3pm)				User Contributed Perl Documentation				TM::Serializable::CSV(3pm)

NAME
TM::Serializable::CSV - Topic Maps, trait for parsing (and later dumping) CSV stream SYNOPSIS
# 1) bare bones my $tm = .....; # get a map from somewhere (can be empty) Class::Trait->apply ($tm, "TM::Serializable::CSV"); use Perl6::Slurp; $tm->deserialize (slurp 'myugly.csv'); # 2) exploiting the timed sync in/out mechanism my $tm = new TM::.... (url => 'file:myugly.csv'); # get a RESOURCEABLE map from somewhere $tm->sync_in; DESCRIPTION
This trait provides parsing and dumping from CSV formatted text streams. INTERFACE
Methods deserialize $tm->deserialize ($text) This method consumes the text string passed in and interprets it as CSV formatted information. What topic map information is generated, depends on the header line (the first line): o If the header line contains a field called "association-type", then all rows will be interpreted as assertions. In that the remaining header fields (in that order) are interpreted as roles (role types). For all rows in the CSV stream, the position where the "association-type" field was is ignored. The other fields (in that order) are affiliated with the corresponding roles. Example: association-type,location,bio-unit is-born,gold-coast,rumsti is-born,vienna,ramsti Scoping cannot be controlled. Also all players and roles (obviously) are directly interpreted as identifiers. Subject identifiers and locators are not (yet) implemented. o If the header line contains a field called "id", then all further rows will be interpreted as topic characteristics, with each topic on one line. The column position where the "id" field in the header is will be interpreted as toplet identifier. All further columns will be interpreted according to the following: o If the header column is named "name", the values will be used as topic names. o Otherwise if the value looks like a URI, an occurrence with that URI value will be be added to the topic. o Otherwise an occurrence with a string value will be added to the topic. Example: name,id,location,homepage "Rumsti",rumsti,gold-coast,http://rumsti.com "Ramsti",ramsti,vienna,http://ramsti.com serialize $tm->serialize [Since TM 1.53] This method serializes a fragment of a topic map into CSV. Which fragment can be controlled with the header line and options (see constructor). "header_line" (only for serialization) This string contains a comma separated list (CSV parseable) of headings. If one of the headings is "association-type", then the generated CSV content will contain associations only. Nothing else is implemented yet. The other headings control which roles (and in which order) should be included in the CSV content. If a particular role type has more than one player, then all players are included. NOTE: As this is inconsistent, this will have to change. "type" (only for serialization) If existing, then this controls which association type is to be taken. "baseuri" (only for serialization) If existing and non-zero, the base URI of the map will remain in the identifiers. Otherwise it will be removed. "specification" If existing (and when selecting only associations), this specification will be interpreted in the sense of "asserts" (see TM). Example: $tm->serialize (header_line => 'association-type,location,bio-unit', type => 'is-born', baseuri => 0); SEE ALSO
TM, TM::Serializable AUTHOR INFORMATION
Copyright 2010 Robert Barta. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. http://www.perl.com/perl/misc/Artistic.html perl v5.10.1 2012-06-05 TM::Serializable::CSV(3pm)
All times are GMT -4. The time now is 08:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy