Sponsored Content
Full Discussion: looping search question
Top Forums Shell Programming and Scripting looping search question Post 302096434 by alfredo123 on Wednesday 15th of November 2006 03:36:46 PM
Old 11-15-2006
Thnx

Thanks a heap Jim...I think the below did the job for me and I needed to search the highest directory to see results from subdirectories.

Code:
!#usr/bin/ksh
#Example usage greptest.sh <filelist> <directory to search>

while read line
    do
    grep -r ${line} $2 
    done <$1
    
exit 0

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

looping question

I am writing a simple script and want to keep the user in a fuction until they are ready to get out. For some (probably stupid) reason, it doesn't seem to be working. You guys see anything that I'm overlooking? crsd() {until do /home/wcs3611.crsdtmp.sh echo 'run another? \c' ... (1 Reply)
Discussion started by: hedrict
1 Replies

2. Shell Programming and Scripting

nested looping question

Hi, I'm having some trouble with the syntax in constructing a simple nested 'for' loop. My code is as follows: #!/bin/bash dir1="fred flume haystack" for dir2 in ${dir1} do fred="1 2 3" flume="a b c" ... (7 Replies)
Discussion started by: Sn33R
7 Replies

3. Shell Programming and Scripting

Perl question - looping through an array of hashrefs

I have an array of hashrefs that look like the following: my @LAYOUT = ( {SQL_1 => "select count (*) FROM prospect WHERE PROCESS_DATE = To_date('INSERT_DATE_HERE', 'mm/dd/yyyy') and tiff_filename is not null ... (2 Replies)
Discussion started by: kregh99
2 Replies

4. UNIX Desktop Questions & Answers

search question

From time to time I need to extract portions of a very large weblogic log file. Each line in the file begins with a date stamp like this: ####<Dec 26, 2005 10:58:30 PM CST> What would be the most efficient way to select all lines in the file between, say, 10:15 PM and 10:20 PM? (1 Reply)
Discussion started by: kf199
1 Replies

5. Shell Programming and Scripting

Looping question

Hi, I have series of data stored in a variable xyz: (between 0 and 100) example: 20 45 98 21..... I need to find if there is/are any occurance of data > 95 Not sure what kind of looping is required to check. Please help. thanks (2 Replies)
Discussion started by: hemangjani
2 Replies

6. UNIX for Dummies Questions & Answers

search and replace one more question

Hi, I have a file that contains the following contents: 14:05 apple orange123 456mango 16:45 banana I wanted to replace ONLY the "14:05 " and "16:45" with nothing and trying to use the following syntax sed -e 's/*//g' -e 's/^: //g' my_file > new_temp cat new_temp apple orange... (2 Replies)
Discussion started by: ghazi
2 Replies

7. Homework & Coursework Questions

Help with looping question

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I need to write a script that accepts 3 filenames as command line parameters and test if they are executable and... (1 Reply)
Discussion started by: tommynewb
1 Replies

8. Shell Programming and Scripting

A question about awk search

I want to search a field and print first field in these record. There is a "*" in the field I want to search, like "TRBD2*01". I used the command like this: awk '/TRBD2*01/ {print $1}' test.txt But it doesn't work. The command line awk '/TRBD2/ {print $1}' test.txt will work. How... (4 Replies)
Discussion started by: xshang
4 Replies

9. Shell Programming and Scripting

Search and replace question

Hi all, I am trying to modify an xml file and I wanted to search and replace using the sed command but here is my issue. I want to search and replace maximumHeapSize="512" and replace it with maximumHeapSize="768" but I have multiple files with different values so I can't search for... (2 Replies)
Discussion started by: reyes99
2 Replies

10. Shell Programming and Scripting

awk pattern match by looping through search patterns

Hi I am using Solaris 5.10 & ksh Wanted to loop through a pattern file by reading it and passing it to the awk to match that value present in column 1 of rawdata.txt , if so print column 1 & 2 in to Avlblpatterns.txt. Using the following code but it seems some mistakes and it is running for... (2 Replies)
Discussion started by: ananan
2 Replies
shells(4)							   File Formats 							 shells(4)

NAME
shells - shell database SYNOPSIS
/etc/shells DESCRIPTION
The shells file contains a list of the shells on the system. Applications use this file to determine whether a shell is valid. See getuser- shell(3C). For each shell a single line should be present, consisting of the shell's path, relative to root. A hash mark (#) indicates the beginning of a comment; subsequent characters up to the end of the line are not interpreted by the routines which search the file. Blank lines are also ignored. The following default shells are used by utilities: /bin/bash, /bin/csh, /bin/jsh, /bin/ksh, /bin/pfcsh, /bin/pfksh, /bin/pfsh, /bin/sh, /bin/tcsh, /bin/zsh, /sbin/jsh, /sbin/sh, /usr/bin/bash, /usr/bin/csh, /usr/bin/jsh, /usr/bin/ksh, /usr/bin/pfcsh, /usr/bin/pfksh, /usr/bin/pfsh, and /usr/bin/sh, /usr/bin/tcsh, /usr/bin/zsh. Note that /etc/shells overrides the default list. Invalid shells in /etc/shells may cause unexpected behavior (such as being unable to log in by way of ftp(1)). FILES
/etc/shells lists shells on system SEE ALSO
vipw(1B), ftpd(1M), sendmail(1M), getusershell(3C), aliases(4) SunOS 5.10 4 Jun 2001 shells(4)
All times are GMT -4. The time now is 07:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy