I want to search the file /etc/passwd for all lines containing 'csh' but exlude all those lines that have '/usr' in them and dump the results into the file result.
IMPORTANT: I need to do this in one command line.
The following does not work:
grep -v \(\/usr\) \(csh\) /etc/passwd >... (4 Replies)
I am using a DEC ALPHA running Digital UNIX (formly DEC OSF/1) and ksh. I have a directory with hundreds of files that only share the extension .rpt. I would like to search that directory based on serial number and operation number and only files that meet both requirements to be printed out. I... (6 Replies)
This is the problem actually:
This regex:
egrep "low debug.*\".*\"" $dbDir/alarmNotification.log
is looking for data between the two quotation marks:
".*\"
When I hate data like this:
low debug 2009/3/9 8:30:20.47 ICSNotificationAlarm Prodics01ics0003 IC... (0 Replies)
Good Morning/Afternoon All,
I am having some trouble creating a variable called "total" to display the sum of the values in a specific field, $6 for example.
The data I am working on is in the following form:
John Doe:(555) 555-5555:1:2:3
Jane Doe:(544) 444-5556:4:5:6
Moe Doe:(654)... (2 Replies)
Hi,
I have a file with below contents,
ssenthil = rw
anilkg = rw
I want to search for "ssenthil" and need to delete line 1 and 2 , if the third line starts with "" respectively and blank line immediately and third line starts with "
anilkg = rw
Please help me .
Great day... (5 Replies)
Hello,
I would like to ask for help with csh script.
An example of an input in .txt file is below, the number of lines varies from file to file and I have 2 or 3 columns with values. I would like to read all the values (probably one by one) and set them to independent unique variables that... (7 Replies)
I have a below file
RCS File name : abc.txt
something
something
....
symbolic names:
implemented : 1.1
ssssssumthing
Revision 1.2
date : 12/12/12 author : abc
Revision 1.1
date : 11/11/11 author xyz
So now , in this file i have to first look for the implemented... (1 Reply)
GM,
I have an issue at work, which requires a simple solution. But, after multiple attempts, I have not been able to hit on the code needed.
I am assuming that sed, awk or even perl could do what I need.
I have an application that adds extra blank page feeds, for multiple reports, when... (7 Replies)
I have a file that looks like this:
>Sample 539
GCCCAGCGCGCGILTGCCGCCGTCTCCGCCTGTCJOHNCCGCCATTGCCCCCGGTTAC
I am using the following code to search specific patterns:
awk '/^>/ { print $0 } NR==2 {if (/GIL/) { print "\t" "1" } else { print "\t" "0" }} NR==2 {if (/JOHN/) { print "\t""\t"... (7 Replies)
Hello Gurus,
I have a multiple pipe separated files which have records going over multiple Lines. End of line separator is \n and records going over multiple lines have <CR> as separator. below is example from one file.
1|ABC DEF|100|10
2|PQ
RS
T|200|20
3| UVWXYZ|300|30
4| GHIJKL|400|40... (7 Replies)
Discussion started by: dJHa
7 Replies
LEARN ABOUT BSD
bm
BM(PUBLIC) BM(PUBLIC)
NAME
bm - search a file for a string
SYNOPSIS
/usr/public/bm [ option ] ... [ strings ] [ file ]
DESCRIPTION
Bm searches the input files (standard input default) for lines matching a string. Normally, each line found is copied to the standard out-
put. It is blindingly fast. Bm strings are fixed sequences of characters: there are no wildcards, repetitions, or other features of regu-
lar expressions. Bm is also case sensitive. The following options are recognized.
-x (Exact) only lines matched in their entirety are printed
-l The names of files with matching lines are listed (once) separated by newlines.
-c Only a count of the number of matches is printed
-e string
The string is the next argument after the -e flag. This allows strings beginning with '-'.
-h No filenames are printed, even if multiple files are searched.
-n Each line is preceded by the number of characters from the beginning of the file to the match.
-s Silent mode. Nothing is printed (except error messages). This is useful for checking the error status.
-f file
The string list is taken from the file.
Unless the -h option is specified the file name is shown if there is more than one input file. Care should be taken when using the charac-
ters $ * [ ^ | ( ) and in the strings (listed on the command line) as they are also meaningful to the Shell. It is safest to enclose the
entire expression argument in single quotes ' '.
Bm searches for lines that contain one of the (newline-separated) strings, using the Boyer-Moore algorithm. It is far superior in terms of
speed to the grep (egrep, fgrep) family of pattern matchers for fixed-pattern searching, and its speed increases with pattern length.
SEE ALSO grep(1)DIAGNOSTICS
Exit status is 0 if any matches are found, 1 if none, 2 for syntax errors or inaccessible files.
AUTHOR
Peter Bain (pdbain@wateng), with modifications suggested by John Gilmore
BUGS
Only 100 patterns are allowed.
Patterns may not contain newlines.
If a line (delimited by newlines, and the beginning and end of the file) is longer than 8000 charcters (e.g. in a core dump), it will not
be completely printed.
If multiple patterns are specified, the order of the ouput lines is not necessarily the same as the order of the input lines.
A line will be printed once for each different string on that line.
The algorithm cannot count lines.
The -n and -c work differently from fgrep.
The -v, -i, and -b are not available.
4th Berkeley Distribution 8 July 1985 BM(PUBLIC)