Sponsored Content
Top Forums Shell Programming and Scripting Simple Script looking for Hard Coded Variables Post 302336205 by serm on Tuesday 21st of July 2009 01:52:37 PM
Old 07-21-2009
Simple Script looking for Hard Coded Variables

Hi Guys

Looking for a little help with a script to grep all files looking for hard coded variables - ie its IP address... so we know which files to look at before an IP change...

This is what I have - but it seems to loop and never end...

Any better suggestions?

Code:
#!/usr/bin/ksh
#simple script to grep for the IP of the host in any file
echo "Enter the IP address you want to find"
read IP
eval log=/tmp/ipfind.out.$IP
tput clear
eval echo "greping all files for $IP"
echo "This will take a considerable amount of time to complete..."
eval echo "Scripts logs to /tmp/ipfind.out.$IP"
cd /
grep -r $IP * 1>$log 2>/dev/null
eval echo "Script complete. please check /tmp/ipfind.out.$IP"
exit

Any help really appreciated...

r

Last edited by vgersh99; 07-21-2009 at 03:16 PM.. Reason: code tags, PLEASE!
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Get enviroment variables into AWK, but not quite that simple!

Hi, I have a script which loops through a file and based on the fields in the file does certain things. I'm just testing the final version and come up against a problem. One of the things is to copy files, so the line in the release.file would look like this. COPY my_file $COPY_DIR 777 ... (1 Reply)
Discussion started by: m1l
1 Replies

2. Shell Programming and Scripting

Simple question (for you guys, hard for me)

I am trying to exit this script by cd'ing into a particular directory. #!/bin/bash /opt/xxx/xxx/d2h $1 fname=$( /opt/xxx/xxx/d2h $1) cd /opt/xxx1/xxx1 find . -name '*'$fname'*' -ls cd /opt/xxx1/xxx1 Upon execution, it returns to my home directory (where I am running this script from. ... (3 Replies)
Discussion started by: BkontheShell718
3 Replies

3. Shell Programming and Scripting

Simple unix variables in script

I'm creating a script that asks a user for a variable ex read filename; read numberinput; I also have a bunch of files named file.0 file.1 ... file.55 I'm trying to delete all files (if they exist) about file.$numberinput. Can someone help me out on how to include the variable as part... (6 Replies)
Discussion started by: jenix4545
6 Replies

4. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

Hello all! This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician. Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix: ... (16 Replies)
Discussion started by: torchij
16 Replies

5. UNIX for Dummies Questions & Answers

Simple example for soft and hard links

Hai, give me a simple example for soft and hard links. this will work for soft link ?? ln -s (2 Replies)
Discussion started by: Ramesh M
2 Replies

6. Programming

How to select option for binary coded value?

Hello everybody, I looking for advice. I'm trying to decode a binary file. Some parameters are "Binary coded", that means that if a byte in hexadecimal is "0A", then in binary is 00001010. So, to decode this Byte I need to refer to the table below (depending the value in binary format, the... (2 Replies)
Discussion started by: Ophiuchus
2 Replies

7. Shell Programming and Scripting

Running a script with multiple variables like 25 variables.

Hi All, i have a requirement where i have to run a script with at least 25 arguements and position of arguements can also change. the unapropriate way is like below. can we achieve this in more good and precise way?? #!/bin/ksh ##script is sample.ksh age=$1 gender=$2 class=$3 . . .... (3 Replies)
Discussion started by: Lakshman_Gupta
3 Replies

8. Shell Programming and Scripting

awk file to read values from Db2 table replacing hard coded values

Hi, I want to replace a chain of if-else statement in an old AWK file with values from Db2 table or CSV file. The part of code is below... if (start_new_rec=="true"){ exclude_user="false"; user=toupper($6); match(user, "XXXXX."); if (RSTART ==2 ) { ... (9 Replies)
Discussion started by: asandy1234
9 Replies
DEVSCRIPTS.CONF(5)						File Formats Manual						DEVSCRIPTS.CONF(5)

NAME
devscripts.conf - configuration file for the devscripts package DESCRIPTION
The devscripts package provides a collection of scripts which may be of use to Debian developers and others wishing to build Debian pack- ages. Many of these have options which can be configured on a system-wide and per-user basis. Every script in the devscripts package which makes use of values from these configuration files describes the specific settings recognised in its own manpage. (For a list of the scripts, either see /usr/share/doc/devscripts/README.gz or look at the output of dpkg -L devscripts | grep /usr/bin.) The two configuration files are /etc/devscripts.conf for system-wide defaults and ~/.devscripts for per-user settings. They are written with bash(1) syntax, but should only have comments and simple variable assignments in them; they are both sourced (if present) by many of the devscripts scripts. Variables corresponding to simple switches should have one of the values yes and no; any other setting is regarded as equivalent to the default setting. All variable names are written in uppercase, and begin with the script name. Package-wide variables begin with "DEVSCRIPTS", and are listed below, as well as in the relevant manpages. For a list of all of the available options variables, along with their default settings, see the example configuration file /usr/share/doc/devscripts/devscripts.conf.ex. This is copied to /etc/devscripts.conf when the devscripts package is first installed. Information about configuration options introduced in newer versions of the package will be appended to /etc/devscripts.conf when the pack- age is upgraded. Every script which reads the configuration files can be forced to ignore them by using --no-conf as the first command-line option. PACKAGE-WIDE VARIABLES The currently recognised package-wide variables are: DEVSCRIPTS_CHECK_DIRNAME_LEVEL, DEVSCRIPTS_CHECK_DIRNAME_REGEX These variables control scripts which change directory to find a debian/changelog file or suchlike, and some other miscellaneous cases. In order to prevent unwanted, even possibly dangerous, behaviour, these variables control when actions will be performed. The scripts which currently make use of these variables are: debc, debchange/dch, debclean, debi, debrelease, debuild and uscan, but this list may change with time (and I may not remember to update this manpage). Please see the manpages of individual scripts for details of the specific behaviour for each script. SEE ALSO
devscripts(1) and /usr/share/doc/devscripts/README.gz. AUTHOR
This manpage was written for the devscripts package by the package maintainer Julian Gilbey <jdg@debian.org>. DEBIAN
Debian Utilities DEVSCRIPTS.CONF(5)
All times are GMT -4. The time now is 10:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy