04-22-2013
AND or OR logic?
Does it have to include both strings or either string?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I am search a string from a file using following command, I want to pick the message ( I.e print $5) from the lookup file if and only if both $hostname and $instancename match.
Message=`cat $lookup_tbl| awk '/'$category'/ {if ('$hostname' == '$2' || '$instancename' == '$3') print $5}'`... (2 Replies)
Discussion started by: sudhish
2 Replies
2. Shell Programming and Scripting
Newbie question -- any help very much appreciated: I want to be able to get grep (or whatever else would work) to return not only matching lines, but also the original input string:
An example may help: Suppose I have two files data1.txt and data2.txt:
data1.txt
Hello my name is foo.
What... (3 Replies)
Discussion started by: tapmas
3 Replies
3. Shell Programming and Scripting
Hi All,
I want to search all the ksh scripts that has following details.
1. Search for "exit 0"
2. Search for "sqlldr" or sqlplus"
3. In the above files i want to search for all the script that has no "case" in it.
Please advice.
Thanks,
Deep (2 Replies)
Discussion started by: deepakpv
2 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I need to find if there is any error in the last few lines of the log file and send a mail accordingly.For example,
Following errors can be logged in the log file.
ERR_1="DB Connection not established"
ERR_2="Server Unloading"
I need to find if these errors are found in the log file and... (3 Replies)
Discussion started by: AnneAnne
3 Replies
5. Shell Programming and Scripting
Hi
I want to search multiple strings in a file . But the search should start with "From" Keyword and end with before "Where" keyword.
Please suggest me.
Thanks (2 Replies)
Discussion started by: sboss
2 Replies
6. UNIX for Dummies Questions & Answers
I want to search files (basically .cc files) in /xx folder and subfolders.
Those files (*.cc files) must contain #include "header.h" AND x() function.
I am writing it another way to make it clear,
I wanna list of *.cc files that have 'header.h' & 'x()'. They must have two strings, header.h... (2 Replies)
Discussion started by: ritikaSharma
2 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I will use below command for grep single string ("osuser" is search string)
ex: find . -type f | xarg grep -il osuser
but i have one more string "v$session"
here i want to grep in which file these two strings are present.
any help is appreciated,
Thanks in advance.
Gagan (2 Replies)
Discussion started by: gagan4599
2 Replies
8. Shell Programming and Scripting
I have a list of files all over a file system e.g.
/home/1/foo/bar.x
/www/sites/moose/foo.txtI'm looking for strings in these files and want to replace each occurrence with a replacement string, e.g.
if I find: '#@!^\&@ in any of the files I want to replace it with: 655#@11, etc.
There... (2 Replies)
Discussion started by: spacegoose
2 Replies
9. Shell Programming and Scripting
Hi, every one!
I have a file with multiple strings.
file1
ATQRGNE
ASQGVKFTE
ASSQYRDRGGLET
SPEQGARSDE
ASSRDFTDT
ASSYSGGYE
ASSYTRLWNTGE
ASQGHNTD
PSLGGGNQPQH
SLDRDSYNEQF
I want to grep each string in hundreds of files in the same directory, further, I want to find out the string... (7 Replies)
Discussion started by: xshang
7 Replies
10. Shell Programming and Scripting
i search between two strings viz <app-deployment> & </app-deployment> and save the contents in a new file using the code snippet below.
sed -n "/<app-deployment/,/<\/app-deployment>/p" deploy.tmp >found1.tmpBut if the search string apprears more than once in the file then how can i store the... (3 Replies)
Discussion started by: mohtashims
3 Replies
LEARN ABOUT OPENDARWIN
strings
STRINGS(1) General Commands Manual STRINGS(1)
NAME
strings - find the printable strings in a object, or other binary, file
SYNOPSIS
strings [ - ] [ -a ] [ -o ] [ -number ] [file ...]
DESCRIPTION
Strings looks for ASCII strings in a binary file or standard input. Strings is useful for identifying random object files and many other
things. A string is any sequence of 4 (the default) or more printing characters ending with a newline or a null. Unless the - flag is
given, strings looks in all sections of the object files except the (__TEXT,__text) section. If no files are specified standard input is
read.
The options to strings(1) are:
-a This option causes strings to look for strings in all sections of the object file (including the (__TEXT,__text) section.
- This option causes strings to look for strings in all bytes of the files (the default for non-object files).
-o Preceded each string by its offset in the file (in decimal).
-number
The decimal number is used as the minimum string length rather than the default of 4.
SEE ALSO
od(1)
BUGS
The algorithm for identifying strings is extremely primitive.
Apple Computer, Inc. October 23, 1997 STRINGS(1)