Sponsored Content
Full Discussion: Help search in files
Top Forums UNIX for Dummies Questions & Answers Help search in files Post 302176109 by pantera975 on Monday 17th of March 2008 11:13:58 AM
Old 03-17-2008
Thank you so much!!! works great! Thanks to both of you!.

Full code below for those that need it. thanks again

Code:
#!/bin/sh
############################################################
# Project: Search for Leads
# Date: 2-26-08
# Name: Adam Fowler
############################################################

clear
folder=workingdir
echo "This program will help you search for leads"
echo ""
echo "What month was the lead sent? Use 2 numbers"
read month
echo "What day was the lead sent? Use 2 numbers"
read day
echo "What hour was the lead sent? Use 2 numbers in 24hr"
read hour
echo "What do you want to search for?"
read unique
cd /usr/local/vitria/BW31/backups/archiveU174/

# copy archives to working directory
cp Partners.Leads.channels.UnprocessedEmail.2008-$month-$day\_$hour* $folder
cp Partners.Leads.channels.EmailIn.2008-$month-$day\_$hour* $folder
cp B2B.Outbound.CMHttpsHigh.channels.Out.2008-$month-$day\_$hour* $folder
cd $folder

# Check to see if they are zipped and unzip them
zipped="B2B.Outbound.CMHttpsHigh.channels.Out.2008-$month-$day"_"$hour.gz Partners.Leads.channels.EmailIn.2008-$month-$day"_"$hour.gz Par
tners.Leads.channels.UnprocessedEmail.2008-$month-$day"_"$hour.gz"
zipped2=`echo *.gz`
if [ "$zipped2" = "$zipped" ]
then
        echo "Unzipping files..."
        gunzip *.gz
        echo "Done unzipping"
fi
echo "*********************************Inbound"******************************************
/usr/xpg4/bin/awk -v unique="$unique" ' {
              if($1 ~ /^Event/) {event=$0}
              if(index($0, unique)>0) { print event, $0; exit}
              } ' Partners.Leads.channels.EmailIn.2008-$month-$day\_$hour
echo "*********************************Outbound"******************************************
/usr/xpg4/bin/awk -v unique="$unique" ' {
              if($1 ~ /^Event/) {event=$0}
              if(index($0, unique)>0) { print event, $0; exit}
              } ' B2B.Outbound.CMHttpsHigh.channels.Out.2008-$month-$day\_$hour
echo "****************************Outbound for Unparced***********************************"
/usr/xpg4/bin/awk -v unique="$unique" ' {
              if($1 ~ /^Event/) {event=$0}
              if(index($0, unique)>0) { print event, $0; exit}
              } ' Partners.Leads.channels.UnprocessedEmail.2008-$month-$day\_$hour

rm Partners.Leads.channels.EmailIn.2008-$month-$day\_$hour*
rm B2B.Outbound.CMHttpsHigh.channels.Out.2008-$month-$day\_$hour*
rm Partners.Leads.channels.UnprocessedEmail.2008-$month-$day\_$hour*
echo "************************************************************************************"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

search for files excluding binary files

Hi All, I need a solution on my following find command find ./.. -name '*.file' -print BTW This gives me the output as belows ./rtlsim/test/ADCONV0/infile/ad0_dagctst.file ./rtlsim/test/ADCONV0/user_command.file ./rtlsim/test/ADCONV0/simv.daidir/scsim.db.dir/scsim.db.file... (2 Replies)
Discussion started by: user_prady
2 Replies

2. Shell Programming and Scripting

search through files

Dears, I have a directory that contains many files,name of the file has a speciefied format like: B<date>-time B20080203-1510,B20080203-1520,.....etc these files contains many counters in the following format: <conter name> <counter value> I need to filter these files based on thier... (5 Replies)
Discussion started by: mm00123
5 Replies

3. UNIX for Advanced & Expert Users

Search files with specfic extention and later search content

Hi, I would appriciate if somebody can help me figure out how to search for all the *.xml file under a specific directory and subdirectroies (/home/username) and later search of content "<start>" inside the xml file returned by search. -Lovin.V (2 Replies)
Discussion started by: lovi_v
2 Replies

4. Shell Programming and Scripting

search files

Hello folks I Hope everyone is fine. I have list of files below aa.tph p3iu.tph a984c.c3c p8xc4.pql I want to search all above files path from /mydata. How to do it with find command with script? (1 Reply)
Discussion started by: learnbash
1 Replies

5. SuSE

Search all files based on first and in all listed files search the second patterns

Hello Linux Masters, I am not a linux expert therefore i need help from linux gurus. Well i have a requirement where i need to search all files based on first patterns and after seraching all files then serach second pattern in all files which i have extracted based on first pattern.... (1 Reply)
Discussion started by: Black-Linux
1 Replies

6. Shell Programming and Scripting

How to access files from different directories and to perform search action in those files?

Hi, I want to access files from different directories (for example: /home/dir1/file1 , /home/dir2/file2 ...) Like this i have to access these files(file1, file2...). (3 Replies)
Discussion started by: bangarukannan
3 Replies

7. Shell Programming and Scripting

"Search for files in a file and write these files to another file which sould be in some other direc

Hi , Need to shell script to extracts files names and write those to another file in different directory. input file is inputfile.txt abc|1|bcd.dat 123 david123 123 rudy2345 124 tinku5634 abc|1|def.dat 123 jevid123 123 qwer2345 124 ghjlk5634 abc|1|pqr.txt 123 vbjnnjh435 123 jggdy876... (1 Reply)
Discussion started by: dssyadav
1 Replies

8. Shell Programming and Scripting

search for content in files. Name of files is in another file. Format as report.

Hi I have multiple files in a folder and one file which contains a list of files (one on each line). I was to search for a string only within these files and not the whole folder. I need the output to be in the form File1<tab>string instance 2<tab> string instance 2<tab>string instance 3... (6 Replies)
Discussion started by: pkabali
6 Replies

9. Shell Programming and Scripting

search information in multiple files and save in new files

hi everyone, im stuck in here with shell :) can you help me?? i have a directory with alot files (genbank files ... all ended in .gbk ) more than 1000 for sure ... and i want to read each one of them and search for some information and if i found the right one i save in new file with new... (6 Replies)
Discussion started by: andreia
6 Replies

10. Shell Programming and Scripting

Search files with today date and files come anytime in between 10 pm to 1 am

Hi, i want to make script. In a directory everyday( exclude sat and sun) in between 10 pm to 1 am there are 2 files comes and when file comes it will mail us. Format for files is mentioned below. please help me on making this, and also have year end consider and if files come after 12 am it... (6 Replies)
Discussion started by: pallvi_mahajan
6 Replies
SOELIM(1)						      General Commands Manual							 SOELIM(1)

NAME
soelim - interpret .so requests in groff input SYNOPSIS
soelim [ -Cv ] [ -Idir ] [ files... ] It is possible to have whitespace between the -I command line option and its parameter. DESCRIPTION
soelim reads files and replaces lines of the form .so file by the contents of file. It is useful if files included with so need to be preprocessed. Normally, soelim should be invoked with the -s option of groff. Note that there must be no whitespace between the leading dot and the two characters `s' and `o'. Otherwise, only groff interprets the .so request (and soelim ignores it). OPTIONS
-C Recognize .so even when followed by a character other than space or newline. -Idir This option may be used to specify a directory to search for files (both those on the command line and those named in .so lines). The current directory is always searched first. This option may be specified more than once, the directories will be searched in the order specified. No directory search is performed for files specified using an absolute path. -v Print the version number. SEE ALSO
groff(1) Groff Version 1.18.1 27 June 2001 SOELIM(1)
All times are GMT -4. The time now is 08:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy