Sponsored Content
Top Forums Shell Programming and Scripting how to search string and number in one file and check in the other file Post 302133206 by knshree on Wednesday 22nd of August 2007 10:51:26 AM
Old 08-22-2007
how to search string and number in one file and check in the other file

Hi,
Can anyone help in the below problem.
file1 has the below contents

fileset 999 primary-ilist inode 37020 has invalid dotdot (426094) -> Not exist
fileset 999 primary-ilist inode 115016 dup block -> /export/jumpstart/solaris9_image/Solaris_9/Product/SUNWgnome-l10nmessages-ptBR/archive
fileset 999 primary-ilist inode 116366 dup block -> /export/jumpstart/solaris9_image/Solaris_9/Product/SUNWgscr/archive
fileset 999 primary-ilist inode 115016 dup block -> /export/jumpstart/solaris9_image/Solaris_9/Product/SUNWgnome-libs/reloc/lib/libglade
fileset 999 primary-ilist inode 116366 dup block ->
fileset 999 primary-ilist inode 116387 dup block
fileset 999 primary-ilist inode 116400 dup block
fileset 999 primary-ilist inode 116435 dup block
fileset 999 primary-ilist inode 116441 dup block
fileset 999 primary-ilist inode 116510 dup block
fileset 999 primary-ilist inode 116521 dup block
fileset 999 primary-ilist inode 116570 dup block
fileset 999 primary-ilist inode 116614 dup block
fileset 999 primary-ilist inode 116616 dup block
fileset 999 primary-ilist inode 29275 dup block
fileset 999 primary-ilist inode 30193 dup block
fileset 999 primary-ilist inode 30318 dup block
fileset 999 primary-ilist inode 30321 dup block
fileset 999 primary-ilist inode 30334 dup block
fileset 999 primary-ilist inode 30336 dup block
fileset 999 primary-ilist inode 30340 dup block
fileset 999 primary-ilist inode 30343 dup block
fileset 999 primary-ilist inode 30344 dup block
fileset 999 primary-ilist inode 30346 dup block
fileset 999 primary-ilist inode 30907 dup block
fileset 999 primary-ilist inode 31026 dup block
fileset 999 primary-ilist inode 31028 dup block
fileset 999 primary-ilist inode 31032 dup block
fileset 999 primary-ilist inode 31035 dup block
fileset 999 primary-ilist inode 31037 dup block
fileset 999 primary-ilist inode 31040 dup block
fileset 999 primary-ilist inode 31041 dup block
fileset 999 primary-ilist inode 31042 dup block
fileset 999 primary-ilist inode 31044 dup block
fileset 999 primary-ilist inode 31045 dup block
fileset 999 primary-ilist inode 31050 dup block
fileset 999 primary-ilist inode 31068 dup block
fileset 999 primary-ilist inode 31180 dup block
fileset 999 primary-ilist inode 31479 dup block
fileset 999 primary-ilist inode 31538 dup block
fileset 999 primary-ilist inode 31558 dup block
fileset 999 primary-ilist inode 31622 dup block

file2 has the below contents
/export/jumpstart/solaris9_image/Solaris_9/Product/SUNWgpch:
total 70
81524 drwxrwxr-x 5 root staff 1024 Jun 29 2004 .
79918 drwxr-xr-x 1098 root bin 32768 Dec 6 2005 ..
81525 drwxr-xr-x 2 root staff 96 Jun 29 2004 archive
116357 drwxr-xr-x 2 root staff 96 Jun 29 2004 install
116361 -rw-r--r-- 1 root staff 460 Jun 29 2004 pkginfo
116362 -rw-r--r-- 1 root staff 225 Jun 29 2004 pkgmap
116363 drwxr-xr-x 3 root staff 96 Jun 29 2004 reloc

/export/jumpstart/solaris9_image/Solaris_9/Product/SUNWgpch/archive:
total 88
81525 drwxr-xr-x 2 root staff 96 Jun 29 2004 .
81524 drwxrwxr-x 5 root staff 1024 Jun 29 2004 ..
116356 -rw-r--r-- 1 root staff 43670 Mar 2 2002 none.bz2

/export/jumpstart/solaris9_image/Solaris_9/Product/SUNWgpch/install:
total 12
116357 drwxr-xr-x 2 root staff 96 Jun 29 2004 .
81524 drwxrwxr-x 5 root staff 1024 Jun 29 2004 ..
116358 -rw-r--r-- 1 root staff 798 Jan 10 2002 copyright
116359 -rw-r--r-- 1 root staff 875 Mar 2 2002 depend
116360 -rw-r--r-- 1 root staff 2245 Mar 2 2002 i.none
/export/jumpstart/solaris9_image/Solaris_9/Product/SUNWgsdhx/archive:
total 50
86697 drwxr-xr-x 2 root staff 96 Jun 29 2004 .
86696 drwxrwxr-x 5 root staff 1024 Jun 29 2004 ..
86698 -rw-r--r-- 1 root staff 24419 Apr 18 2002 none.bz2

/export/jumpstart/solaris9_image/Solaris_9/Product/SUNWgsdhx/install:
total 12
86699 drwxr-xr-x 2 root staff 96 Jun 29 2004 .
86696 drwxrwxr-x 5 root staff 1024 Jun 29 2004 ..
86700 -rw-r--r-- 1 root staff 93 Apr 7 2002 copyright
86701 -rw-r--r-- 1 root staff 724 Apr 6 2002 depend
86702 -rw-r--r-- 1 root staff 2245 Apr 18 2002 i.none

I have to check '37020' from file1 and check exist in file2, if it exists print the file path
how to do this????????
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

count the number of files which have a search string, but counting the file only once

I need to count the number of files which have a search string, but counting the file only once if search string is found. eg: File1: Please note that there are 2 occurances of "aaa" aaa bbb ccc aaa File2: Please note that there are 3 occurances of "aaa" aaa bbb ccc... (1 Reply)
Discussion started by: sudheshnaiyer
1 Replies

2. UNIX for Dummies Questions & Answers

how can search a String in one text file and replace the whole line in another file

i am very new to UNIX plz help me in this scenario i have two text files as below file1.txt name=Rajakumar. Discipline=Electronics and communication. Designation=software Engineer. file2.txt name=Kannan. Discipline=Mechanical. Designation=CADD Design Engineer. ... (6 Replies)
Discussion started by: kkraja
6 Replies

3. Shell Programming and Scripting

search a string in a particular column of file and return the line number of the line

Hi All, Can you please guide me to search a string in a particular column of file and return the line number of the line where it was found using awk. As an example : abc.txt 7000,john,2,1,0,1,6 7001,elen,2,2,0,1,7 7002,sami,2,3,0,1,6 7003,mike,1,4,0,2,1 8001,nike,1,5,0,1,8... (3 Replies)
Discussion started by: arunshankar.c
3 Replies

4. Shell Programming and Scripting

How to search number of occurrences of a particular string in a file through vi editor?

i have one file, i am doing 'vi Filename' now i want to search for particular string and i want to know how many times that string occurs in whole file (5 Replies)
Discussion started by: sheelsadan
5 Replies

5. Shell Programming and Scripting

Help in printing n number of lines if a search string matches in a file

Hi I have below script which is used to grep specific errors and if error string matches send an email alert. Script is working fine , however , i wish to print next 10 lines of the string match to get the details of error in the email alert Current code:- #!/bin/bash tail -Fn0 --retry... (2 Replies)
Discussion started by: neha0785
2 Replies

6. Shell Programming and Scripting

Need to search a particular String form a file a write to another file using perl script

I have file which contains a huge amount of data. I need to search the pattern Message id. When that pattern is matched I need to get abcdeff0-1g6g-91g3-1z2z-2mm605m90000 to another file. Kindly provide your input. File is like below Jan 11 04:05:10 linux100 |NOTICE... (2 Replies)
Discussion started by: Raysf
2 Replies

7. Shell Programming and Scripting

Search string within a file and list common words from the line having the search string

Hi, Need your help for this scripting issue I have. I am not really good at this, so seeking your help. I have a file looking similar to this: Hello, i am human and name=ABCD. How are you? Hello, i am human and name=PQRS. I am good. Hello, i am human and name=ABCD. Good bye. Hello, i... (12 Replies)
Discussion started by: royzlife
12 Replies

8. Shell Programming and Scripting

Read in search strings from text file, search for string in second text file and output to CSV

Hi guys, I have a text file named file1.txt that is formatted like this: 001 , ID , 20000 002 , Name , Brandon 003 , Phone_Number , 616-234-1999 004 , SSNumber , 234-23-234 005 , Model , Toyota 007 , Engine ,V8 008 , GPS , OFF and I have file2.txt formatted like this: ... (2 Replies)
Discussion started by: An0mander
2 Replies

9. Shell Programming and Scripting

Search a string in a file which is also present in another file in UNIX

Hi there, I am new to Unix and had below requirement to finish my task. I have file1.dat which has data as shown below. case1.txt case2.txt case3.txt case4.txt file1.dat has only file names I have folder which has above files mentioned in file1.dat ./all_files case1.txt... (6 Replies)
Discussion started by: raj028
6 Replies

10. UNIX for Beginners Questions & Answers

Search a string and display its location on the entire string and make a text file

I want to search a small string in a large string and find the locations of the string. For this I used grep "string" -ob <file name where the large string is stored>. Now this gives me the locations of that string. Now how do I store these locations in a text file. Please use CODE tags as... (7 Replies)
Discussion started by: ANKIT ROY
7 Replies
All times are GMT -4. The time now is 06:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy