Sponsored Content
Full Discussion: pattern list?
Top Forums UNIX for Dummies Questions & Answers pattern list? Post 2109 by jelizondo1010 on Friday 20th of April 2001 06:35:44 AM
Old 04-20-2001
Question

I'm working with a text file and I want to count the lines containing the word "timing" or "dochar" or both. How can I do this in the C-Shell?. I have trying with grep but I can't specify more than one word to be searched.
`THANK'S TO MIB FOR THE LAST ANSWER, JUST GREAT!! '

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Korn pattern-list with a variable

I am trying to use a pattern-list match in korn shell using a variable and it always seems to regard the pattern-list as a literal: Using the directory names explicitly in the pattern-list works fine: ls @(test|test1)/test.txt and returns: test/test.txt Trying to use a variable for this... (2 Replies)
Discussion started by: partchimp
2 Replies

2. UNIX and Linux Applications

Need to list pattern only not containing whole line

I am searching a pattern item_id>000111111</item_id> in an XML file. More than one occurance are there for this patter in a single line. I have tried awk '/item_id/,/item_id/' tpnb1.txt>abc.txt Full lines containg pattern are coming. I need only list of 000111111. (1 Reply)
Discussion started by: tredev
1 Replies

3. Shell Programming and Scripting

using sed to replace a pattern in list of files

Hi All, using the below grep command,I get the following output: $grep -irl "bc" /home/applmgr/amit > file_list.log $cat file_list.log /home/applmgr/amit/xyz.log /home/applmgr/amit/abc.log Requirement ========= Need sed utility to replace "bc" with "xy" pattern in the list of files... (4 Replies)
Discussion started by: a1_win
4 Replies

4. Shell Programming and Scripting

how to list files with certain pattern

Hi I have files in the following naming convention, for example, /t1/bin/asrv270 /t1/bin/asrv270.sav /t1/bin/asrv2392.px2392.has_been_deleted.sav /t1/bin/asrv2713.sav.sav etc... The number after "asrv" is different. I need to list only the files which end up with the number, for example, ... (2 Replies)
Discussion started by: aoussenko
2 Replies

5. UNIX for Advanced & Expert Users

Unix: list out Pattern occurrence (count)

Need to search a pattern occurrence (count) in a specified file. Below is the details $ cat fruits apple apple ball ball apple ball ball ball apple apple apple cat cat cat cat cat apple apple Note: If I'll use the grep command with -c option then it'll count the 1st occurrence in... (6 Replies)
Discussion started by: tp2115
6 Replies

6. Shell Programming and Scripting

list files with a specific pattern

How can I list files with the following specific criteria? I am trying this $> ls *.log or $>ls *.log? --> but it only gives me fsaffa.log1, rwerw.log2. How can I get all three files with a simple selection criteria ? (5 Replies)
Discussion started by: kchinnam
5 Replies

7. UNIX for Dummies Questions & Answers

List only files based on a pattern

Hi Gurus, I need to list only the files with out certain extension. For eg from the following list of files: I need to only list: Thanks Shash (7 Replies)
Discussion started by: shash
7 Replies

8. Shell Programming and Scripting

Pattern list to remove from other file

I have fileA: Joey.smith /my/path/to/here here bill@smith /my/path/to/there there John@smith /my/path/to/anywhere anywhereI have fileB: bill@smithI want to end with fileC: Joey.smith /my/path/to/here here John@smith /my/path/to/anywhere anywhereThus remove B from A, the whole line. I've... (3 Replies)
Discussion started by: crowman
3 Replies

9. Linux

Search multiple pattern from list

I am working on AIX operating system. I want to search list of Article Id for given Set Date (which are present in a seperate file input.txt) art_list.csv ------------ "Article ID" |"Ad Description" |"Pyramid"|"Pyramid Desc "|"ProductTypeId"|"Set Date "|... (3 Replies)
Discussion started by: rajivrsk
3 Replies

10. Shell Programming and Scripting

Need help with pattern matching to list missing packages

I have wrote this small program to check for installed and missing packages in LINUX (RHEL x86_64) For now it perfectly prints all the installed and missing packages however I want that it loops through to the end (in either case) and list all packages however if one or more packages are... (5 Replies)
Discussion started by: Dazzler74
5 Replies
GREP(1) 						      General Commands Manual							   GREP(1)

NAME
grep - search a file for lines containing a given pattern SYNOPSIS
grep [-elnsv] pattern [file] ... OPTIONS
-e -e pattern is the same as pattern -c Print a count of lines matched -i Ignore case -l Print file names, no lines -n Print line numbers -s Status only, no printed output -v Select lines that do not match EXAMPLES
grep mouse file # Find lines in file containing mouse grep [0-9] file # Print lines containing a digit DESCRIPTION
Grep searches one or more files (by default, stdin) and selects out all the lines that match the pattern. All the regular expressions accepted by ed and mined are allowed. In addition, + can be used instead of * to mean 1 or more occurrences, ? can be used to mean 0 or 1 occurrences, and | can be used between two regular expressions to mean either one of them. Parentheses can be used for grouping. If a match is found, exit status 0 is returned. If no match is found, exit status 1 is returned. If an error is detected, exit status 2 is returned. SEE ALSO
cgrep(1), fgrep(1), sed(1), awk(9). GREP(1)
All times are GMT -4. The time now is 03:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy