Hi
There is one problem which i am not able to find the solution
Suppose there are two files tmpfile1 and tmpfile2 .
tmpfile1 contains data as
:bash> cat tempfile1
1222
1234
1234
1234
:bash>
now my code is written as
getcommand="cat tmpfile2"
while(getcommand | getline)
{
#Do something
}
Now My question is i want to search in tempfile1 in
getcommand="cat tmpfile2"
while(getcommand | getline)
{
#### how to search parameter (1222) in tempfile1
#Do something
}
Please help me regarding this.
Please use code tag while posting any code or your input/output file.
Hi,Try this,
awk 'NR==FNR{a[$1]++;next}a[$1]' tempfile1 tempfile2
Hi Thanks for your reply
but your solution seems to modify the entire query i can not change the
"getling" query.
neither i can remove the while function as this is exsisting functionality that's y
I think there must be other approach so that we can solve the query.
Please help
ctsgnb
February 10, 2011, 4:13am
4
Please give what is in tmpfile1 and tmpfile1 and how should the output look like.
Hi all
Thanks for ur reply
Now my detailed problem is
suppose tmpFile1 contains data as
1222
1223
1224
1225
and tmpfile2 contains the data as
abc;def
1601;0000
1222;0001
1603;0002
1112;0003
1224;0004
now initally the code is doing as
getcommand="cat tmpfile2"
while(getcommand | getline)
{
### i want to print only those colums which are not included in tmpFile1 and included in tmpFile2
}
so the expected output will be
abc;def
1601;0000
1603;0002
1112;0003
I have to do it from above functionality only .
Please help me regarding this.
ctsgnb
February 10, 2011, 10:26am
6
fgrep -v tmpFile1 tmpFile2
?
awk 'NR==FNR{a[$1]=$1;next}!a[$1]' temp1 FS=";" temp2
@above
Hi thanks for ur reply..
but i am not suppose to change the functionality of
while(getcommand | getline )
{
# i have to search here only in tempfile1
}
Can you people please help me in finding the solution