The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 07-16-2008
forumsgr forumsgr is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 3
parsing file2 with input from file1

Sorry dublication with previous thread... please delete it
Hi all

i need and appreciate your help creating a script in ksh for the following case
Two files exists with questionmark delemeter:

File1.txt:
A;B;C;F;D;K;

File2.txt
A,name,address1; K,name,surname,phone; C,name,phone; D,name,address,phone,email; E,surname,phone; F,name,surname; W,name,jobtitle; B,name,address;

The need is to use the File1.txt as input for parsing File2.txt (match line) and produce a File3.txt like below in order to be able to count lines as well:

File3.txt:
A,name,address1;
B,name,address;
C,name,phone;
D,name,address,phone,email;
F,name,surname;
K,name,surname,phone;

Since FILE1.txt and FILE2.txt are hundrens or even thousands of lines, a normal forloop would crash the system or would take ages to be completed in serial way.

BR
CJ

Last edited by forumsgr; 07-16-2008 at 06:29 AM..