`find`, pulling 1st field from ASCII flat file as search/-name?
Hey Everyone!
I have searched around for this on Unix.com and Google, and I'm either not phrasing my search properly or this is not as simple as I thought...
I have a script that runs on a nightly basis that pulls one field worth of data from an internal MySQL database and populates to an ASCII flat file at the system level. If you cat this file, looks like this:
KDJ
OPO
DE1
Also at the file system level from another process, I create log files that have {DATE}_{FIRSTFIELD} IE 10062009_KDJ, 10062009_OPO...
What I need to do is use "find" to search for all of the files that *contain* the 1st field reading from that ASCII flat file, basically, using some sort of array that pulls each field so that in one find command, I can get a list of files.
Using KornShell, I can achieve building a list from the flat file and printing:
BUT how do I make use of $CODES placing in a wildcard "find" function like:
find /log/complete -name '*$CODES*' -print
where $CODES would look for any filename that contain *KDJ*,*OPO*, etc? It's like a seperate array would have to exist within the find search?
Thanks for any help:-) I'm pulling my hair out.
Last edited by pludi; 10-06-2009 at 04:56 PM..
Reason: code tags please...
Complete with example no less!!! Hey thanks a lot for the post, this is *exactly* what I needed to do:-). I can now finish this process I've been working on, I'll put your handle in my comments like a good person:-)
I am trying to add 0393 value at 24th feild using the below command, but its adding at all the lines including header and trailer
Input file:
ZHV|2657|D0217001|T|TXU|Z|PAN|20131112000552||||OPER|
754|52479|
492|489|SP40|1014570286334|20131111|20131201|14355334|CHAMELON... (1 Reply)
Hi ,
I have been trying to write a perl script to do this job. But i am not able to achieve the desired result. Below is my code.
my $current_value=12345;
my @users=("bob","ben","tom","harry");
open DBLIST,"<","/var/tmp/DBinfo";
my @input = <DBLIST>;
foreach (@users)
{
my... (11 Replies)
Hi
I am new to unix and newbie to this forum. I need help in writing a gawk script that search and replace particular text in a flat file.
Input file text :
ZIDE_CONTROL000 100000000003869920900000300000001ISYNC 000002225489 0000000002232122 20120321 16:40:53
ZIDE_RECORD000... (5 Replies)
I have a csv flatfile with a few million rows. I need to replace a field (field number is 85) in the file with a sequential number.
As an example, let's assume there are only 4 fields in the file:
A,A,,32
A,A,,27
A,B,,43
C,C,,354
If I wanted to amend the 3rd field in this way my... (2 Replies)
Hi,
Let say I have a file which has around 400 fields.
SampleFile
=========
PATIENTID|FACILITY|................|TIME_LAST_VISITED_BY_MD|.....|STATUS|
How is it possible to find out which field is TIME_LAST_VISITED_BY_MD?fro example by seeing the above structure we can saw FACILITY... (5 Replies)
Hi all,
I did not use UNIX for a long time, now i need to make a flat file with extra field, can you help me with the code ?
1. I create a last line of each log from each system and make it in a flat text file (seperate by a pipe |)
mv current.log old
tail -1 sanfrancisco.log > current.log... (5 Replies)
I am on AIX Unix. I want to read a flat file for a string in a certain byte. I want to find the value: 943034 in column 56; and write out just those records to another file. Also, could I get the line/record number of where it was found in the input file?
Thank you,
sboxtops (1 Reply)
I need to be able to search a flat file (comma-separated values) for a specific value and then return the following 2 fields into variables. Here's a sample flat file:
SN,Account,IPaddress
W120394YF,adam,10.0.20.2
W394830PR,betty,10.0.20.3
W847582TD,charlie,10.0.20.4... (7 Replies)
Hi everybody. I need help and I hope someone is willing to help me out here.
My wholesale company is currently moving to new software. The old software is running on a UNIX platform. We need to migrate data from the UNIX system, but our former software provider refuses to assist the data... (5 Replies)
Greetings....
I'm looking for the command and syntax to search files, several actually, that will find the string pattern "\0;" and delete it. I have over 200 files to change :o
Thanx (2 Replies)