How to count lines of CSV file where 2 fields match variables?
I'm trying to use awk to count the occurrences of two matching fields of a CSV file.
For instance, for data that looks like this...
I've been trying to use code like this...
Assuming the variable is Blue, I would like to see
The third column seems to work, but I can't get the second to work with a variable. Can anybody tell me what I'm doing wrong?
I have a csv file looking like:
echo,w-cai,w-cai-ssl
echo,countrywide,countrywide-ssl
haystack,intranet3,intranet3-ssl
haystack,pnf,pnf-ssl
Basically, I want to process this file row by row assigning each word delimited by a comma to a variable.
ie. for the first row, $variable1=echo... (5 Replies)
I have a CSV file with a variable number of fields per record. How do I print lines of a certain number of fields only? Several permutations of the following (including the use of escape characters) have failed to retrieve the line I'm after (1,2,3,4)...
$ cat myfile
1,2,3,4
1,2,3
$ # Print... (1 Reply)
I am writing a package manager in BASH and I would like a small snippet of code that finds lines that match exact input and count them. For example, my file contains:
xyz
xyz-lib2.0+
xyz-lib2.0
xyz-lib1.5
and "grep -c xyz" returns 4.
The current function is:
# $1 is the package name.... (3 Replies)
Hello everyone,
Maybe somebody could help me with an awk script.
I have this input (field separator is comma ","):
547894982,M|N|J,U|Q|P,98,101,0,1,1
234900027,M|N|J,U|Q|P,98,101,0,1,1
234900023,M|N|J,U|Q|P,98,54,3,1,1
234900028,M|H|J,S|Q|P,98,101,0,1,1
234900030,M|N|J,U|F|P,98,101,0,1,1... (2 Replies)
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)
Hi, I am newbie in shell script.
I need your help to solve my problem.
Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file.
File1:
SourceFile,DateTimeOriginal
/home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07... (8 Replies)
In the below awk I am trying output to one file those lines that match between $2,$3,$4 of file1 and file2 with the count in (). I am also trying to output those lines that are missing between $2,$3,$4 of file1 and file2 with the count of in () each. Both input files are tab-delimited, but the... (7 Replies)
I am trying to remove all the lines and spaces where the count in $4 or $5 is greater than 1 (more than 1 letter). The file and the output are tab-delimited. Thank you :).
file
X 5811530 . G C NLGN4X
17 10544696 . GA G MYH3
9 96439004 . C ... (1 Reply)
In the awk below, what I am attempting to do is check each line in the tab-delimeted input, which has ~20 lines in it, for a keyword
SVTYPE=Fusion. If the keyword is found I am splitting $3 using the . (dot) and reading the portion before and after the dot in an array a.
If it does have that... (12 Replies)
I am trying to parse two csv files and make a match in one column then print the entire file to a new file and append an additional column that gives description from the match to the new file. If a match is not made, I would like to add "NA" to the end of the file
Command that Ive been using... (6 Replies)
Discussion started by: dis0wned
6 Replies
LEARN ABOUT DEBIAN
rdf::trine::exporter::csv
RDF::Trine::Exporter::CSV(3pm) User Contributed Perl Documentation RDF::Trine::Exporter::CSV(3pm)NAME
RDF::Trine::Exporter::CSV - Export RDF data to CSV
VERSION
This document describes RDF::Trine::Exporter::CSV version 1.000
SYNOPSIS
use RDF::Trine::Exporter::CSV;
DESCRIPTION
The RDF::Trine::Exporter::CSV class provides an API for serializing RDF data to CSV strings and files.
METHODS
"new ( sep_char => $sep_char, quote => $bool )"
Returns a new RDF::Trine::Exporter::CSV object. If $sep_char is provided, it is used as the separator character in CSV serialization,
otherwise a comma (",") is used.
"serialize_iterator_to_file ( $file, $iterator )"
Serializes the bindings objects produced by $iterator, printing the results to the supplied filehandle "<$fh">.
"serialize_iterator_to_string ( $iterator )"
Serializes the bindings objects produced by $iterator, returning the result as a string.
BUGS
Please report any bugs or feature requests to through the GitHub web interface at <https://github.com/kasei/perlrdf/issues>.
AUTHOR
Gregory Todd Williams "<gwilliams@cpan.org>"
COPYRIGHT
Copyright (c) 2006-2012 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms
as Perl itself.
perl v5.14.2 2012-06-29 RDF::Trine::Exporter::CSV(3pm)