If I read your description correctly, you wish to take a value from column n, and if it appears in any other column in the row, to print that row. For instance:
This row would be printed if the value in column 2 were found (which it is) in any other column.
If this is correct, then this awk should work:
Change the value in red to be the column number (1 based) for the column you wish to use the value from.
It's possible that you want to look for the value from column n in another file, not in the same row of file1. If that is the case, please indicate that there are two files involved and it would help, as elixir_sinari has said, to have a sample of input and desired output.
Any help to read the contents of a variable length csv ....??(using awk)
The csv mite look like this :
anjali,ram,rahul,mohini,sam,.... and so on ...
I need to pick up each name..
Thanks in advance
SD (3 Replies)
Hello experts,
I am trying to read a line from a csv file that contains '.doc' and print the second column in all caps.
e.g.
My csv file contains:
Test.doc|This is a Test|test1|tes,t2|test-3
Test2.pdf|This is a Second Test| test1|tes,t2|t-est3
while read line
do
echo "$line" |... (3 Replies)
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... (3 Replies)
Hi
Here is my script that calls my awk script
#!/bin/bash
set -x
dir="/var/local/dsx/csv"
testfile="$testfile"
while getopts " f: " option
do
case $option in
f ) testfile="$OPTARG";;
esac;
done
./scriptFile --testfile=$testfile >> $dir/$testfile.csv
It calls my awk... (1 Reply)
Hello,
am I new to awk, and I am tryint to:
INPUT FILE:
"73423555","73423556","73423557","73423558","73423559"
OUTPUT FILE:
73423555
73423556
73423557
73423558
73423559
My useless code so far:
#!/bin/awk -F ','
BEGIN
{
i=0;
} (8 Replies)
Hi Fellows,
I have been struggling to fix an issue in csv records to compose sql statements and have been really losing sleep over it. Here is the problem:
I have csv files in the following pipe-delimited format:
Column1|Column2|Column3|Column4|NEWLINE
Address Type|some descriptive... (4 Replies)
Hi
I have two csv files, with the following formats:
FileA.log:
Application, This occured blah
Application, That occured blah
Application, Also this
AnotherLog, Bob did this
AnotherLog, Dave did that
FileB.log:
Uk, London, Application, datetime, LaterDateTime, Today it had'nt... (8 Replies)
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)
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)
Example:
I have files in below format
file 1:
zxc,133,joe@example.com
cst,222,xyz@example1.com
File 2 Contains:
hxd
hcd
jws
zxc
cst
File 1 has 50000 lines and file 2 has around 30000 lines :
Expected Output has to be :
hxd
hcd
jws (5 Replies)