The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Expect script with file input problems meberline Shell Programming and Scripting 1 05-29-2008 04:40 PM
input from a file into an expect script ? starsky Shell Programming and Scripting 2 04-16-2008 11:38 AM
File as input for a script innocentspirit Shell Programming and Scripting 5 10-26-2007 12:03 AM
Script for reading an input file gzs553 Shell Programming and Scripting 1 10-17-2006 06:55 AM
file as input for script finster Shell Programming and Scripting 1 11-11-2004 06:27 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-16-2008
forumsgr forumsgr is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 3
Red face Parshing script using input from a file to another

Hi all
As quite newbie in shell scripting i need your help.
The case: two files with question mark delimeter:
file1.txt:
A; B; D; E;

file2.txt:
a,antonis,red; b,maria,green; c,george,blue; d,jack,red; e,Helen,yellow; k,konstantin,black;

I need an effiecient way of parsing while it will read the file1.txt as input to the file2.txt and produce a file3.txt with the following results, in order to be able also to count the lines of the results:

file3.txt:
a,antonis,red;
b,maria,green;
d,jack,red;
e,Helen,yellow;

I was thinking some "for loop" but since file1.txt will be from hundren to some thousand of entries and file2.txt is almost a million lines to look into, this serial way will take ages (if the server will not crushed eventually ).
Any help is more than welcome. I am working on Solaris 9 or 10 if that helps.
BR
CJ
  #2 (permalink)  
Old 07-16-2008
DukeNuke2's Avatar
DukeNuke2 DukeNuke2 is offline Forum Staff  
Soulman
  
 

Join Date: Jul 2006
Location: Germany, Berlin
Posts: 2,910
is this homework? please read our rules before posting!
  #3 (permalink)  
Old 07-16-2008
forumsgr forumsgr is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 3
Unfortunatelly I am to old for school and there is almost a year since my last script.
i kow that i have to use awk and probably sed with substr defining the delimeter, but all the post I checked are talking either for fixed number of lines using AWK NF or fixed lenght of string.

Trully sorry for the inconvience...
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 03:52 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0