06-29-2017
I see what was wrong. In my example data I foolishly included the line numbers from my file. Once I adjusted fields for this error it worked flawlessly.
Thank you so much RudiC and R. Singh.
If it is not too much trouble, would someone be kind enough to explain this code for me? I'm tracking fairly well but got confused when variable "q" is assigned to $2 but then is included in array A.
Last edited by jvoot; 06-29-2017 at 02:52 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have two files. 1st file has 1 column (huge file containing ~19200000 lines) and 2nd file has 2 columns (small file containing ~6000 lines).
#################################
huge_file.txt
a
a
ab
b
##################################
small_file.txt
a 1.5
b 2.5
ab ... (4 Replies)
Discussion started by: AshwaniSharma09
4 Replies
2. Shell Programming and Scripting
Hi Experts,
I am very new to scripting and have a prb since few days and it is urgent to solve so much appreciated if u help me.
i have 2 files
file1.txt
9647810043118
9647810043126
9647810043155
9647810043161
9647810043166
9647810043185
9647810043200
9647810043203
9647810043250... (22 Replies)
Discussion started by: mustafa.abdulsa
22 Replies
3. Shell Programming and Scripting
Hi,
I have a file filled with search strings which have a blank in between and look like this:
S. g. Ehr.
o. Jg.
v. d. Chijs
g. Ehr.
Now i would like to search for the strings and it also shall return the next column after the match.
awk -v FILE="search_strings.txt" 'BEGIN {... (10 Replies)
Discussion started by: sdf
10 Replies
4. Shell Programming and Scripting
I have two files... file1 and file2.
Where columns 1 and 2 of file1 match columns 1 and 2 of file2 I want to create a new file that is all file1 + columns 3 and 4 of file2
:b: Many thanks if you know how to do this.... :b:
file1
31-101 106 0 92
31-101 106 29 ... (2 Replies)
Discussion started by: pelhabuan
2 Replies
5. Shell Programming and Scripting
I have a file with many lines which contain strings like .. etc.
But with no rule regarding field separators or anything else.
I want to print ONLY THE STRING from each line , not the entire line !!!
For example from the lines :
Flow on service executed with success in . Performances... (5 Replies)
Discussion started by: black_fender
5 Replies
6. Shell Programming and Scripting
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)
Discussion started by: Ophiuchus
2 Replies
7. Shell Programming and Scripting
Hi experts,
I have a file with regexes which is used for automatic searches on several files (40+ GB).
To do some postprocessing with the grep result I need the matching line as well as the match itself.
I know that the latter could be achieved with grep's -o option. But I'm not aware of a... (2 Replies)
Discussion started by: stresing
2 Replies
8. Shell Programming and Scripting
Trying to use awk to match the contents of each line in file1 with $5 in file2. Both files are tab-delimited and there may be a space or special character in the name being matched in file2, for example in file1 the name is BRCA1 but in file2 the name is BRCA 1 or in file1 name is BCR but in file2... (6 Replies)
Discussion started by: cmccabe
6 Replies
9. UNIX for Beginners Questions & Answers
I've written an awk script to compare two fields in two different files and then print portions of each file on the same line when matched. It works reasonably well, but every now and again, I notice some errors and cannot seem to figure out what the issue may be and am turning to you for help.
... (2 Replies)
Discussion started by: jvoot
2 Replies
10. UNIX for Beginners Questions & Answers
I cannot seem to get what should be a simple awk one-liner to work correctly and cannot figure out why. I would like to use patterns from a specific field in one file as regex to search for matching strings in the entire line ($0) of another file.
I would like to output the lines of File2 which... (1 Reply)
Discussion started by: jvoot
1 Replies