>The Unix Shell
Home
About
Pages
Full Width
Right Sidebar
Left Sidebar
404 Page
Download
Using awk to only print the matching lines in two files
Saturday, December 29, 2012
awk
0 Comments
below is the code:
awk 'FNR==NR{a[$0];next}($0 in a)' file2 file1
for more explanation please see below link:
using-awk-to-delete-lines-from-file
Vijay
0 comments:
Newer Post
Home
Older Post
Subscribe to:
Post Comments (Atom)
Popular Posts
List of Bash Conditional statements
Moving a process from background to foreground
Executing shell command in c/c++ and parsing the output
The Definitive C++ Book Guide and List
Bulk rename of files in unix
Find and replace a string in c++
Split a string by anything other than spaces
Inserting lines in a file using Perl
What is Undefined Behavior?
Look ahead and Look behind in perl
Facebook
About The Author
I am a software programmer working in India. I usually like to blog in my free time.
...Read More
Labels
array
auto
awk
bash
books
c
c++
compare
copy
cpu
cut
Data Structures
dbx
debugger
dtrace
explicit
expr
find
fork
ftp
gdb
grep
head
interview-question
isql
java
join
malloc
match
mdb
memory
memory leaks
mv
nawk
One liners
paste
pattern match
perl
perl script
perl-hashes
perldoc
plsql
popen
process
ps
regex
rename
replace
reverse
scp
search
sed
shell
shell variable
shell-script
shell-scripting
solaris
sort
split
sql
stl
string
sybase
table
tail
tar
truss
unix
vector
vi
vim
xargs
Search This Blog
Blog Archive
►
2024
(1)
►
April
(1)
►
2017
(2)
►
March
(2)
►
2014
(15)
►
June
(1)
►
May
(5)
►
April
(7)
►
March
(1)
►
February
(1)
►
2013
(50)
►
November
(1)
►
September
(2)
►
July
(2)
►
June
(4)
►
May
(8)
►
April
(4)
►
March
(4)
►
February
(4)
►
January
(21)
▼
2012
(50)
▼
December
(50)
Interesting perl One-liner
Return type of malloc
Moving a process from background to foreground
Join every two lines in a file
Compare two files and replace
Print lines after every n lines in a file
Delete duplicate lines in a file in Unix
Delete comments from a C/C++ source file
Searching multiple strings in VI editor
Understanding C++ polymorphism
Archiving files in a directory - tar command
Changing the extension of large number of files
Reverse a list of numbers stored in a variable
Using The Perl Debugger
Using awk to only print the matching lines in two ...
Using awk to delete lines from a file which are pr...
File comparisons using awk: Match columns
AWK one-liner for multi-column comparision two uns...
Print lines between two patterns in a file
Using Perl's -F flag
Ftp using perl and getting the files based upon a ...
Print every character in a new line
Extracting Range of lines in perl
Print limited characters per a line
Find and replace a string in all the files recursi...
secure copy in a shell script
Change format of a field using awk
Join lines based on a pattern
Join lines based upon the first field
Join consequent lines in unix
Check for perl modules installed
Using Perl File::Find
Executing Sql query in a Perl script
Compare two files in Perl
Sort unix processes by memory usage
Shell Script for taking backup
Sort file on columns and characters
Truss using a process id
Breaking an infinite loop in a shell script
Removing duplicates from a line
Split a line into 5 fields each into multiple lines
Printing lines after a match is found
Add the contents of one file into other based upon...
sort contents of a file based upon the fields
Add line just before the first match
Count the number of occurrences of each letter by row
Delete lines from a file
extract the contents in between the tags
extract the contents in between the tags
Comparing two files using awk
Powered by
Blogger
.
Pages
Home
Perl
Awk
Sed
C/C++
Java
Shell Scripting
About Myself
Gallery
Contact Us
Name
Email
*
Message
*
Popular Posts
List of Bash Conditional statements
At times you need to specify different courses of action to be taken in a shell script, depending on the success or failure of a command. Th...
Sort unix processes by memory usage
Below is a most simple command for Sorting Unix processes by highest memory usage: ps -eo pmem,pid,pcpu,rss,vsz,time,args | sort -k 1 -r ...
Bulk rename of files in unix
Most of the time it is required that w eneed to rename the files in bulk. this can be done in many ways,Mostly people do it by writing a s...
Debugging a PL/SQL Stored procedure
Normally while working on PL/SQL stored procedures , we use DBMS_TRACE for knowing about the values of various variables and put some print...
Executing shell command in c/c++ and parsing the output
Often we need to execute some shell command and get the output of that shell command in c. system will simply execute the shell command but...
The Definitive C++ Book Guide and List
This question attempts to collect the few pearls among the dozens of bad C++ books that are released every year.Unlike many other programmin...
Comparing two files using awk
I have two files File 1 contains 3 fields File 2 contains 4 fields The number of rows of File 1 is much smaller than that of File 2 I...
What is Undefined Behavior?
In computer programming , undefined behavior refers to computer code whose behavior is unpredictable. It is a feature of some programming l...
Finding Memory leaks in C++ on solaris Unix
There are lot of ways where one can identify memory leaks and lots of blogs and materieals are available to help a designer to identify the...
extract the contents in between the tags
<?xml version="1.0" encoding="utf-8"?> <job xmlns="http://www.sample.com/">programming</job...
0 comments: