Sponsored Content
Top Forums Shell Programming and Scripting Find required files by pattern in xml files and the change the pattern on Linux Post 302468425 by DGPickett on Tuesday 2nd of November 2010 05:17:00 PM
Old 11-02-2010
Listing is easy enough, I guess:
Code:
 
grep -l '<keyword>[^<]*some word[^<]*<\/keyword>' *.xml

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

find pattern in FILES and replace it ??

Hi How can I looking for a pattern found in more than one file and replace it with anther pattern this what I was used: find . -name "account.adrs" -depth -follow -exec grep -l "Email = ;" {} \; this print the files name -which is account.adrs- and its path -which is deferent for each... (4 Replies)
Discussion started by: tamer
4 Replies

2. Shell Programming and Scripting

How to find files which has more than one occurance of pattern

Hello Everyone, Please help me in finding out the solution. The problem is .. lets say i have 600 files in a directory. All 600 files are shell script files. Now i need to find out the files which contains a pattern "SHELL" more than once. No matter how the pattern occurs , it can be in... (10 Replies)
Discussion started by: Prahlad
10 Replies

3. UNIX for Dummies Questions & Answers

Find files matching a pattern

Hi, I am writing a BASH shell script. I would like to count all the files in the CURRENT directory matching a specific pattern. Could someone suggest the best/simplest way to do this. I have thought of these solutions (for simplicity the pattern is all files starting with A): ls -1 *A | wc -l... (5 Replies)
Discussion started by: msb65
5 Replies

4. UNIX for Dummies Questions & Answers

find files NOT matching name pattern

Hi, I have following files in my directory: /TESTDONTDEL> ls -alt total 14 drwxr-xr-x 2 oracle dba 1024 May 15 06:30 . -rw-r--r-- 1 oracle dba 40 May 15 06:30 exception.txt -rw-r--r-- 1 oracle dba 19 May 15 06:22 ful_1234_test1.txt -rw-r--r-- 1... (2 Replies)
Discussion started by: sagarparadkar
2 Replies

5. Shell Programming and Scripting

To find the files with pattern and display

Hi all, Im looking for a script(bash,perl) to find the files which has content with ORA (Mostly will be from log file)if we find those content,need to send a mail alert to the team members with the files which are matched. This script should run daily so that it should search for the files... (1 Reply)
Discussion started by: preetha_83
1 Replies

6. Shell Programming and Scripting

Help required to find pattern

Hi All, I have a oracle code & want to exclude the comments present in the code. Below may be the pattern can be considered for eg. -- ALTER TABLE ALTER TABLE -- To create In above sample, First line is full commented line as it starts with "--" Wheras the second line is starting... (2 Replies)
Discussion started by: gr8_usk
2 Replies

7. Shell Programming and Scripting

How to find files in a pattern directory?

Hi, I have more than 1000 directories under one directory (lets says under /home/). Sub directories are like A1 to A100,B1 to B100 etc.. Here my problem is I need to find the files older than 10 days in the directories which starts with A*. I tried some thing like this which is not... (2 Replies)
Discussion started by: shhrikanth
2 Replies

8. Shell Programming and Scripting

split XML file into multiple files based on pattern

Hello, I am using awk to split a file into multiple files using command: nawk '{ if ( $1 == "<process" ) { n=split($2, arr, "\""); file=arr } print > file }' processes.xml <process name="Process1.process"> ... (3 Replies)
Discussion started by: chiru_h
3 Replies

9. Shell Programming and Scripting

Script to find only files that contain pattern

Actually I googled it and found != *Frequent* works! So now I have zero questions Thanks for reading, anyway! Actually I got this working see below. I just now have one question: How do you use a test condition (such as with Frequent) that takes whitespace into account for example, if the... (2 Replies)
Discussion started by: newbie2010
2 Replies

10. Shell Programming and Scripting

sed -- Find pattern -- print remainder -- plus lines up to pattern -- Minus pattern

The intended result should be : PDF converters 'empty line' gpdftext and pdftotext?xml version="1.0"?> xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 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 05:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy