02-22-2018
Thank you very much
.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hey,
I have a file and it has only one field. I need to calculate the sum of each filed as total.
For e.g my file is
1
2
3
4
5
I need to calculate the total sum as 15.
Please let me know how i can do it? (4 Replies)
Discussion started by: dsravan
4 Replies
2. UNIX for Dummies Questions & Answers
I have file
"1","x1897"," 89.10"
"1","x2232"," -12.12"
"1","x1897"," 389.10"
"1","x2232"," 212.12"
"1","x1897"," 19.10"
"1","x2232"," 2.12"
i want to add all 3 rd column rows (they have spaces also)for x1
and sum of 3rd column rows for x2 separately.
I am very... (8 Replies)
Discussion started by: i.scientist
8 Replies
3. Shell Programming and Scripting
Hello ,
I have comma delimited file with over 20 fileds that i need to do some validations on. I have to check if certain fields are null and then write the line containing the null field into a new file and then delete the line from the current file.
Can someone tell me how i could go... (2 Replies)
Discussion started by: goddevil
2 Replies
4. Shell Programming and Scripting
I'm trying to sum each field of the second column over many different files.
For example:
file1: file2:
1 5 1 5
2 6 2 4
3 5 3 3
To get:
file3
1 10
2 10
3 8
I found answer when there are only 2 files as... (10 Replies)
Discussion started by: rogeriog.em
10 Replies
5. Shell Programming and Scripting
I have a simple text file having payment amount value on each line. At the end of day 'n' number of payments created difference in amount that I need to match from this file.
I have information about how many payments created difference and difference amount. Please help me to build shell... (3 Replies)
Discussion started by: swats007
3 Replies
6. Shell Programming and Scripting
Dear AWK-experts!
I did get stuck in the task of combining files after matching fields, so I'm still awkward with learning AWK.
There are 2 files: one containing 3 columns with ID, coding status, and score for long noncoding RNAs:
file1 (1.txt) (>5000 lines)
... (12 Replies)
Discussion started by: kben
12 Replies
7. Shell Programming and Scripting
Hi,
file1.txt
AAA
BBB
CCC
DDD
file2.txt
abc|AAA|AAAabcbcs|fnwufnq
bca|nwruqf|AAA|fwfwwefwef
fmimwe|BBB|fnqwufw|wufbqw
wcdbi|CCC|wefnwin|wfwwf
DDD|wabvfav|wqef|fwbwqfwfe
i need the count of rows of file1.txt present in the file2.txt
required output:
AAA 2 (10 Replies)
Discussion started by: mdkm
10 Replies
8. Shell Programming and Scripting
Trying to use awk to store the value of $5 in file1 in array x. That array x is then used to search $4 of file1 to find aa match (I use x to skip the header in file1). Since $4 can have multiple strings in it seperated by a , (comma), I split them and iterate througn each split looking for a match.... (2 Replies)
Discussion started by: cmccabe
2 Replies
9. Shell Programming and Scripting
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
10. UNIX for Beginners Questions & Answers
In the awk below I am trying to cp and paste each matching line in f2 to $3 in f1 if $2 of f1 is in the line in f2 somewhere. There will always be a match (usually more then 1) and my actual data is much larger (several hundreds of lines) in both f1 and f2. When the line in f2 is pasted to $3 in... (4 Replies)
Discussion started by: cmccabe
4 Replies
LEARN ABOUT DEBIAN
plan9-join
JOIN(1) General Commands Manual JOIN(1)
NAME
join - relational database operator
SYNOPSIS
join [ options ] file1 file2
DESCRIPTION
Join forms, on the standard output, a join of the two relations specified by the lines of file1 and file2. If one of the file names is the
standard input is used.
File1 and file2 must be sorted in increasing ASCII collating sequence on the fields on which they are to be joined, normally the first in
each line.
There is one line in the output for each pair of lines in file1 and file2 that have identical join fields. The output line normally con-
sists of the common field, then the rest of the line from file1, then the rest of the line from file2.
Input fields are normally separated spaces or tabs; output fields by space. In this case, multiple separators count as one, and leading
separators are discarded.
The following options are recognized, with POSIX syntax.
-a n In addition to the normal output, produce a line for each unpairable line in file n, where n is 1 or 2.
-v n Like -a, omitting output for paired lines.
-e s Replace empty output fields by string s.
-1 m
-2 m Join on the mth field of file1 or file2.
-jn m Archaic equivalent for -n m.
-ofields
Each output line comprises the designated fields. The comma-separated field designators are either 0, meaning the join field, or
have the form n.m, where n is a file number and m is a field number. Archaic usage allows separate arguments for field designators.
-tc Use character c as the only separator (tab character) on input and output. Every appearance of c in a line is significant.
EXAMPLES
sort /etc/passwd | join -t: -1 1 -a 1 -e "" - bdays
Add birthdays to the /etc/passwd file, leaving unknown birthdays empty. The layout of /adm/users is given in passwd(5); bdays con-
tains sorted lines like
tr : ' ' </etc/passwd | sort -k 3 3 >temp
join -1 3 -2 3 -o 1.1,2.1 temp temp | awk '$1 < $2'
Print all pairs of users with identical userids.
SOURCE
/src/cmd/join.c
SEE ALSO
sort(1), comm(1), awk(1)
BUGS
With default field separation, the collating sequence is that of sort -b -ky,y; with -t, the sequence is that of sort -tx -ky,y.
One of the files must be randomly accessible.
JOIN(1)