Sponsored Content
Top Forums Shell Programming and Scripting Read CSV column value based on column name Post 302371474 by JohnGG on Sunday 15th of November 2009 04:26:07 AM
Old 11-15-2009
Read CSV column value based on column name

Hi All,

I am newbie to Unix I ve got assignment to work in unix

can you please help me in this regard

There is a sample CSV file
"Username", "Password"
"John1", "Scot1"
"John2", "Scot2"
"John3", "Scot3"
"John4", "Scot4"

If i give the column name as Password and row number as 4 the result I should get '

'Scot3'

can you please help me in writing shell script for the above

Thanks
John
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sorting csv file based on column selected

Hi all, in my csv file it'll look like this, and of course it may have more columns US to UK;abc-hq-jcl;multimedia UK to CN;def-ny-jkl;standard DE to DM;abc-ab-klm;critical FD to YM;la-yr-tym;standard HY to MC;la-yr-ytm;multimedia GT to KJ;def-ny-jrt;critical I would like to group... (4 Replies)
Discussion started by: tententen
4 Replies

2. Shell Programming and Scripting

extract csv based on column value

Hi I have a csv file which is below A,5 B,6 C,10 D,7 I want the values who's second column is greater than 7 say C,10 D,7 Help me please... Thanks, Maruth (3 Replies)
Discussion started by: maruthavanan
3 Replies

3. Shell Programming and Scripting

awk read column csv and search in other csv

hi, someone to know how can i read a specific column of csv file and search the value in other csv columns if exist the value in the second csv copy entire row with all field in a new csv file. i suppose that its possible using awk but i m not expertise thanks in advance (8 Replies)
Discussion started by: giankan
8 Replies

4. Shell Programming and Scripting

Read in 2-column CSV, output many files based on field

Is there a way to read in a two-columned CSV file, and based on the fields in 1st column, output many different files? The input/output looks something like: input.csv: call Call Mom. call Call T-Mobile. go Go home. go Go to school. go Go to gas station. play Play music. play Play... (4 Replies)
Discussion started by: pxalpine
4 Replies

5. Shell Programming and Scripting

Pick the column value based on another column from .csv file

My scenario is that I need to pick value from third column based on fourth column value, if fourth column value is 1 then first value of third column.Third column (2|3|4|6|1) values are cancatenated. Main imp point, in my .csv file, third column is having price value with comma (1,20,300), it has... (2 Replies)
Discussion started by: Ganesh L
2 Replies

6. Linux

Filter a .CSV file based on the 5th column values

I have a .CSV file with the below format: "column 1","column 2","column 3","column 4","column 5","column 6","column 7","column 8","column 9","column 10 "12310","42324564756","a simple string with a , comma","string with or, without commas","string 1","USD","12","70%","08/01/2013",""... (2 Replies)
Discussion started by: dhruuv369
2 Replies

7. Shell Programming and Scripting

Fetching values in CSV file based on column name

input.csv: Field1,Field2,Field3,Field4,Field4 abc ,123 ,xyz ,000 ,pqr mno ,123 ,dfr ,111 ,bbb output: Field2,Field4 123 ,000 123 ,111 how to fetch the values of Field4 where Field2='123' I don't want to fetch the values based on column position. Instead want to... (10 Replies)
Discussion started by: bharathbangalor
10 Replies

8. Shell Programming and Scripting

Compare two csv's with column based

Hi, I am having below two CSV's col_1,col_2,col_3 1,2,4 1,3,6 col_1,col_3,col2,col_5,col_6 1,2,3,4,5 1,6,3,,, I need to compare based on the columns where the mismatch is expected output col_1,col_2,col_3 1,2,4 (3 Replies)
Discussion started by: rohit_shinez
3 Replies

9. Shell Programming and Scripting

Get maximum per column from CSV file, based on date column

Hello everyone, I am using ksh on Solaris 10 and I'm gathering data in a CSV file that looks like this: 20170628-23:25:01,1,0,0,1,1,1,1,55,55,1 20170628-23:30:01,1,0,0,1,1,1,1,56,56,1 20170628-23:35:00,1,0,0,1,1,2,1,57,57,2 20170628-23:40:00,1,0,0,1,1,1,1,58,58,2... (6 Replies)
Discussion started by: ejianu
6 Replies

10. UNIX for Beginners Questions & Answers

Filtering records of a csv file based on a value of a column

Hi, I tried filtering the records in a csv file using "awk" command listed below. awk -F"~" '$4 ~ /Active/{print }' inputfile > outputfile The output always has all the entries. The same command worked for different users from one of the forum links. content of file I was... (3 Replies)
Discussion started by: sunilmudikonda
3 Replies
ISCSI.CONF(5)							File Formats Manual						     ISCSI.CONF(5)

NAME
iscsi.conf - iSCSI Target and LUN configuration SYNOPSIS
/etc/iscsi.conf DESCRIPTION
This manual page describes the format of the /etc/iscsi.conf file. This file is a simple text file that iscsid(8) uses to locate iSCSI tar- get devices and LUNs. Comments are marked by lines beginning with '#'. Available entries include: DiscoveryAddress=<address> IP address or hostname to use for target discovery. A TCP port number may be specified by appending a colon followed by the port number. This entry must start in the first column, and must not contain any whitespace. TargetIpAddr=<address> A synonym for DiscoveryAddress. Username=<user> Specify the authentication user. If this entry precedes all DiscoveryAddress entries, it serves as the default. If this entry is indented under a DiscoveryAddress entry, it specifies the user for all targets discovered at that IP address. Password=<pass> Specify the authentication password for the previously listed iSCSI If this entry precedes all DiscoveryAddress entries, it serves as the default. If this entry is indented under a DiscoveryAddress entry, it specifies the user for all targets discovered at that IP address. EXAMPLE
# set the default user and password Username=alice Password=nty57nbe # targets at this address will use the default Username and Password DiscoveryAddress=192.168.10.94 # targets at this address will use the Username and Password below DiscoveryAddress=192.168.10.95 Username=beatrice Password=93fdgc20 NOTES
The iSCSI initiator drivers, README files, and example configuration files are available on the Linux-iSCSI homepage at: http://linux-iscsi.sourceforge.com <http://linux-iscsi.sourceforge.com> FILES
/etc/iscsi.conf iSCSI Target and LUN configuration SEE ALSO
iscsid(8) $Revision: 1.9 $ $Date: 2002/09/19 20:00:32 $ ISCSI.CONF(5)
All times are GMT -4. The time now is 07:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy