the program too slow there is any solution?


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
# 8  
you are right but the second files is many records data I wnant to make some change onit look to the example now:
first file like this
00123211025469700000120000000012365478965412300000

and the second file is select statment from oracle like this
0625488 02159 112364 12654


depinding to the first record i want to make my modifing


thank for your particpation
# 9  
So, awk can modify records. So can C. I don't get what the problem is.
# 10  
jim mcnamara can give me tha aidia of solution in awk
look the first file like this:
000000010415FLT_P_708
100000010599000278260
210000000000000000000
140000010716000278260
160000010686000278260
200000010117000278260
200000020117000278260
200000030117000278260
290000010149000278260


and the second file like this :
0278260 215 1254
0953665 254 1236

do you see the boold part in the first file he does match the fist field in the second file (and note i wnat to work on records that begin with 10 in the first file)
how we can do that with fast program in awk

thanks in advance
# 11  
Based on your requirements:
firstfile - if it starts with "10" - the last 7 chars are a possible search key
secondfile - if the first column matches any of the search keys, print the whole record.
Code:
awk ' FILENAME=="firstfile"{
                             if (/^10/){ arr[substr($0,15,7)]=1 }
                          }
      FILENAME=="secondfile" {
                             if (arr[$1]) {print $0 }
                          }
    ' firstfile  secondfile

# 12  
I want to recopy all the records on the first file not just 10
but when the key search on 10 match the field1 on the second file make some change on record 10 for example add the second field from the second to the end of record 10 or modify a specific part on record 10
hope its clear now

thank for your partisipate
# 13  
document for details

can you tell me site or document for more details for awk I/O because I need more explain




Quote:
Originally Posted by jim mcnamara
Based on your requirements:
firstfile - if it starts with "10" - the last 7 chars are a possible search key
secondfile - if the first column matches any of the search keys, print the whole record.
Code:
awk ' FILENAME=="firstfile"{
                             if (/^10/){ arr[substr($0,15,7)]=1 }
                          }
      FILENAME=="secondfile" {
                             if (arr[$1]) {print $0 }
                          }
    ' firstfile  secondfile

Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #859
Difficulty: Medium
AJAX is designed for two-way client-server communications.
True or False?

3 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Calling compiled C program with Perl program

Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
Discussion started by: jdkirby
1 Replies

2. Shell Programming and Scripting

Please can you help me find a solution in this program in unix ?

Write shell script to read 3 numbers and print them in revers and print wither they are polyndrome numbers or not ????? (2 Replies)
Discussion started by: lovelorn_mn
2 Replies

3. UNIX for Dummies Questions & Answers

Script to open program and send/execute command in program

Hi, i want to write a script that executes a program (exec?) . this program then requires a filename as input. how do i give it this input in the script so the program will be complete run and close by the script. e.g. exec prog.exe program then asks for filename "enter filename:"... (1 Reply)
Discussion started by: tuathan
1 Replies

Featured Tech Videos