Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script to create multiple files off multiple grep strings

Status
Not open for further replies.

LDHB2012

Technical User
Dec 17, 2012
1
US
Hi everybody...

I'm completely new to the forums and extremely new to scripting. I've been through a few tutorials to get started on learning the perl language. I'm decent with linux CLI and I'm looking for ways to make life easier with some of the things I'll be doing.

I wanted to create a script that allows for multiple grep 'string' searches and then outputs the results to a file named 'grep'd string'.

Here's the scenario:
-One directory with multiple flat files which contain many rows of events which are delimited by |
-I want separate files created for each string I'm interested in and each file can be named after the string I specify through grep
-So I'll create a text file, I suppose, to contain all the strings I want to grep, where the script would point to that file as a reference for each grep command
-after every grep, a file should be created
-I want to run this weekly, as new files are added to the directory
-Upon running it weekly, I want the new info to be appended to it's respective file, but without creating duplicates from grep'ing the older files.

I think that pretty much sums it up. Please let me know if I can explain this better, or simply, more info is needed.

-David
 
hello

I am not of english origin, so, not everything is simple to understand.
As I understud, you want to

1. use a script to ad and list multiple Events on different dates. each event listed in single file, but alle events listable as whole or in categories.

2. delete Events wich do not longer exists.

3. You want it in flatfile DB.

3. and possibly a few specific tasks around the above functions.

Why not just take an existing solution like a basic EveryAuction 1.53, and remove everything you don't need to function.

This would be a standard USER Registry File:
---
userpassword
admin@whatever.info
Ernst Jacob
Post Box No.5555
Whereever, TX 66410
517 333 44 555
1946
Schweiz
what is your mothers maiden name
Bonifaz
antiques11178010000 # just present, if user has active items
antiques41180300500 # thos entries could be removed also
antiques21178485358 # if info ist not required
---
This below Flatfile DB displays an Item in a category.
This Item carries an individual Number, existing only once in this form.
---
This would be a title
This would be a subtitle
0.00 reserve proce when it is an auction
1.00 Startprice set by seller
This would be the description
This would be the condition
This would be the featured Gallery Yes/no Information
This would be the preset value Whatever 1
This would be the preset value Wathever 2
This would be the preset value Wathever 3
0.00 Buyit Price (Option)
-
the Next Line looks different, it represent the Seller Information:
-
Hans[]xxxx@bxxxxx.ch[]1.00[]1179858792[]Hans Zubler[]Heuweg x[]xxxx Aarau[]0xx 888 5555[]1970[]Schweiz[]0
-
following lines represent the Bidder Information, each one per Bidding.
-
Ernie[]admin@xxxxxx.info[]1.00[]1179948869#1.00#[]Ernst Jacob[]Postfach xx[]
Othmarsingen[]0xx xxx xxxx[]1946[]Schweiz[]
---
This should give you the Idea, how those files are built.
When looking for selected data, User/Item File Content reading is, like writing, split in lines, each line so represented by a $variable, wich is used in the different Script Subsections to collect, sort , display and handle the Content.
---
Item File 'Array' (believed, this is the correct word)
my ($title, $reserve, $inc, $desc, $image, $seller, $bidder, $bid, $bids, $bidtime, $type, $keywords) = &read_item_file($form{'category'},$form{'item'});
---
Item File, Bidder File 'Array'
my ($alias, $email, $bid, $time, $add1, $add2, $add3, $phone, $age, $zip, $showbids) = &read_bid($bids[$#bids]); # read last bid
---
Item File, Seller File 'Array'
my ($salias, $semail, $sbid, $stime, $sadd1, $sadd2, $sadd3, $sphone, $sage, $szip, $sshowbids) = &read_bid($bids[0]); # read first bid
---
User Registration File 'array'
my ($password,$email,$add1,$add2,$add3);
---
Ok, looking at the above, you will understand how the script basically operates. You can save 'any specific ' Information in an individual File. You can call those different files in all possible ways, meaning, you can search for them, you can display files as favorites, you could visually ENHANCE closing time with a special Image or the time like here:

Link

If Events close, they either go into a closed item section or they are deleted immediately.

You will have a little work, if this is what you are looking for. If not, at least, now you know how EveryAuction operates.

Good luck, if you need a little help, let me know. It's free...

Ernie

PS. I never censor my writings...
 
I forgot to mention: above shown sample (array)-lines are taken out of different scripts, they DO NOT MATCH in real action...

Ernie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top