Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Compare 1st column from 2 file and if match print line from 1st file and append column 7 from 2nd Post 303032265 by RudiC on Thursday 14th of March 2019 10:10:58 AM
Old 03-14-2019
Now, this problem has been solved umpteen times in these fora. Try searching relevant threads and adapting the given solutions. You may start with the links at this page's lower left under "More UNIX and Linux Forum Topics You Might Find Helpful".
This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

two files.say a and b.both have long columns.i wanna match the column fron 1st file w

ex: a file has : 122323 123456456 125656879 678989965t635 234323432 b has : this is finance no. this is phone no this is extn ajkdgag idjsidj i want the o/p as: 122323 his is finance no. 123456456 this is phone no 123456456 ... (4 Replies)
Discussion started by: TRUPTI
4 Replies

2. Shell Programming and Scripting

Awk+Grep Input file needs to match a column and print the entire line

I'm having problems since few days ago, and i'm not able to make it works with a simple awk+grep script (or other way to do this). For example, i have a input file1.txt: cat inputfile1.txt 218299910417 1172051195 1172070231 1172073514 1183135117 1183135118 1183135119 1281440202 ... (3 Replies)
Discussion started by: poliver
3 Replies

3. Shell Programming and Scripting

Strings from one file which exactly match to the 1st column of other file and then print lines.

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

4. Shell Programming and Scripting

Match a line in File 1 with Column in File 2 and print whole line in file 2 when matched

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

5. Shell Programming and Scripting

comparing column of two different files and print the column from in order of 2nd file

Hi friends, My file is like: Second file is : I need to print the rows present in file one, but in order present in second file....I used while read gh;do awk ' $1=="' $gh'" {print >> FILENAME"output"} ' cat listoffirstfile done < secondfile but the output I am... (14 Replies)
Discussion started by: CAch
14 Replies

6. Shell Programming and Scripting

1st column,2nd column on first line 3rd,4th on second line ect...

I need to take one column of data and put it into the following format: 1st line,2nd line 3rd line,4th line 5th line,6th line ... Thanks! (6 Replies)
Discussion started by: batcho
6 Replies

7. Shell Programming and Scripting

Grep/Awk on 1st 2 Letters in 2nd Column of File

Hi everyone. I need to change a script (ksh) so that it will grep on the 1st 2 letters in the second column of a 5 column file such as this one: 192.168.1.1 CAXY0_123 10ABFL000001 # Comment 192.168.1.2 CAYZ0_123 10ABTX000002 # Comment 192.168.2.1 FLXY0_123 11ABCA000001 ... (4 Replies)
Discussion started by: TheNovice
4 Replies

8. Shell Programming and Scripting

How to read file line by line and compare subset of 1st line with 2nd?

Hi all, I have a log file say Test.log that gets updated continuously and it has data in pipe separated format. A sample log file would look like: <date1>|<data1>|<url1>|<result1> <date2>|<data2>|<url2>|<result2> <date3>|<data3>|<url3>|<result3> <date4>|<data4>|<url4>|<result4> What I... (3 Replies)
Discussion started by: pat_pramod
3 Replies

9. Linux

Print the 1st column and the value in 2nd or 3rd column if that is different from the values in 1st

I have file that looks like this, DIP-17571N|refseq:NP_651151 DIP-17460N|refseq:NP_511165|uniprotkb:P45890 DIP-17571N|refseq:NP_651151 DIP-19241N|refseq:NP_524261 DIP-19241N|refseq:NP_524261 DIP-17151N|refseq:NP_524316|uniprotkb:O16797 DIP-19588N|refseq:NP_731165 ... (2 Replies)
Discussion started by: Syeda Sumayya
2 Replies

10. Shell Programming and Scripting

Input file needs to match a column and print the entire line

I have a file with class c IP addresses that I need to match to a column and print the matching lines of another file. I started playing with grep -if file01.out file02.out but I am stuck as to how to match it to a column and print the matching lines; cat file01.out 10.150.140... (5 Replies)
Discussion started by: lewk
5 Replies
WWW::Mechanize::Cookbook(3pm)				User Contributed Perl Documentation			     WWW::Mechanize::Cookbook(3pm)

NAME
WWW::Mechanize::Cookbook - Recipes for using WWW::Mechanize INTRODUCTION
First, please note that many of these are possible just using LWP::UserAgent. Since "WWW::Mechanize" is a subclass of LWP::UserAgent, whatever works on "LWP::UserAgent" should work on "WWW::Mechanize". See the lwpcook man page included with the libwww-perl distribution. BASICS
Launch the WWW::Mechanize browser use WWW::Mechanize; my $mech = WWW::Mechanize->new( autocheck => 1 ); The "autocheck => 1" tells Mechanize to die if any IO fails, so you don't have to manually check. It's easier that way. If you want to do your own error checking, leave it out. Fetch a page $mech->get( "http://search.cpan.org" ); print $mech->content; "$mech->content" contains the raw HTML from the web page. It is not parsed or handled in any way, at least through the "content" method. Fetch a page into a file Sometimes you want to dump your results directly into a file. For example, there's no reason to read a JPEG into memory if you're only going to write it out immediately. This can also help with memory issues on large files. $mech->get( "http://www.cpan.org/src/stable.tar.gz", ":content_file" => "stable.tar.gz" ); Fetch a password-protected page Generally, just call "credentials" before fetching the page. $mech->credentials( 'admin' => 'password' ); $mech->get( 'http://10.11.12.13/password.html' ); print $mech->content(); LINKS
Find all image links Find all links that point to a JPEG, GIF or PNG. my @links = $mech->find_all_links( tag => "a", url_regex => qr/.(jpe?g|gif|png)$/i ); Find all download links Find all links that have the word "download" in them. my @links = $mech->find_all_links( tag => "a", text_regex => qr/download/i ); APPLICATIONS
Check all pages on a web site Use Abe Timmerman's WWW::CheckSite http://search.cpan.org/dist/WWW-CheckSite/ <http://search.cpan.org/dist/WWW-CheckSite/> SEE ALSO
WWW::Mechanize AUTHORS
Copyright 2005-2010 Andy Lester "<andy@petdance.com>" Later contributions by Peter Scott, Mark Stosberg and others. See Acknowledgements section in WWW::Mechanize for more. perl v5.14.2 2011-08-05 WWW::Mechanize::Cookbook(3pm)
All times are GMT -4. The time now is 09:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy