Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Pattern matching and Printing Filename Post 302337031 by drewrockshard on Thursday 23rd of July 2009 09:04:29 AM
Old 07-23-2009
Quote:
Originally Posted by krao
Thank you very much JIM,

It's working.

Pls do one more favor to me, I want to run above one as script, pls tell me what changes to be done inorder to give pattern at the begining instead of giving at nawk command. i.e ./pattern_filename_script xfvc010423465107

Thanks in advance.
You do something like the following:

Code:
SEARCH="$1"
find /data3/home/ -type f -name 'TRCansLog*.gz' |
while read filename 
do   
   gzcat $filename | nawk -v fname=$filename '/'$SEARCH'/ {print $0 "\t" fname}'
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Filename and Pattern matching

Hiiiii every one, I am facing a problem while giving a file name which has space in it. The problem is ... I have to read a file where the set of input files are stored. Now getting that name I have to open the file and i have to extract the name of the user from where it is written like"by... (2 Replies)
Discussion started by: kheyali Mitra
2 Replies

2. Shell Programming and Scripting

comment/delete a particular pattern starting from second line of the matching pattern

Hi, I have file 1.txt with following entries as shown: 0152364|134444|10.20.30.40|015236433 0233654|122555|10.20.30.50|023365433 ** ** ** In file 2.txt I have the following entries as shown: 0152364|134444|10.20.30.40|015236433 0233654|122555|10.20.30.50|023365433... (4 Replies)
Discussion started by: imas
4 Replies

3. Shell Programming and Scripting

counting the lines matching a pattern, in between two pattern, and generate a tab

Hi all, I'm looking for some help. I have a file (very long) that is organized like below: >Cluster 0 0 283nt, >01_FRYJ6ZM12HMXZS... at +/99% 1 279nt, >01_FRYJ6ZM12HN12A... at +/99% 2 281nt, >01_FRYJ6ZM12HM4TS... at +/99% 3 283nt, >01_FRYJ6ZM12HM946... at +/99% 4 279nt,... (4 Replies)
Discussion started by: d.chauliac
4 Replies

4. UNIX for Advanced & Expert Users

fgrep - printing pattern and filename

Hi, I have a patternfile with following pattern cat dog cow pig Let's say I have thousand files file0001 file0002 file0003 . . . file1000 Each pattern can occur multiple times in multiple files. How can I search for pattern so the output of pattern and the filename is printed... (1 Reply)
Discussion started by: yoda9691
1 Replies

5. UNIX for Dummies Questions & Answers

Help with filename pattern matching

Hi, I have files in a directory with filenames that match three specific patterns: 1) *'.L2_LAC'* 2) *'.L2_LAC_OC'* 3) *'.L2_LAC_SST'* I would like to have an "ls" command that will list only files matching the first two patterns. However, if I type: ls *'.L2_LAC'* I will get files that... (2 Replies)
Discussion started by: msb65
2 Replies

6. Shell Programming and Scripting

Pattern Matching and printing

Dear All, I have a log file like below 13:26:31 |152.22 13:27:31 |154.25 13:28:31 |154.78 13:29:31 |151.23 13:30:31 |145.63 13:31:31 |142.10 13:32:31 |145.45 where values will be there from 00:00 hrs to 23:59 hrs. I'm matching for last occurance of 23:59 and printing 1440 lines (grep... (4 Replies)
Discussion started by: Naga06
4 Replies

7. Shell Programming and Scripting

Sed: printing lines AFTER pattern matching EXCLUDING the line containing the pattern

'Hi I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match. Which option is to be used to exclude the line containing the pattern? sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies

8. Shell Programming and Scripting

Find: filename in every subdirectory matching a pattern

Hi, I have multiple directories built in following manner /app/red/tmp /app/blue/upd /app/blue/tmp /app/green/tmp /app/red/upd /app/green/upd I have filenames having pattern ONE.XXX.dat TWO.ZZZ.dat and so on across the folders listed above My objective is to list all filenames of a... (4 Replies)
Discussion started by: wahi80
4 Replies

9. Shell Programming and Scripting

UNIX awk pattern matching and printing lines

I have the below plain text file where i have some result, in order to mail that result in html table format I have written the below script and its working well. cat result.txt Page 2015-01-01 2000 Colors 2015-02-01 3000 Landing 2015-03-02 4000 #!/bin/sh LOG=/tmp/maillog.txt... (1 Reply)
Discussion started by: close2jay
1 Replies

10. Shell Programming and Scripting

Need help on pattern matching and printing the same

Hi, I need to match for the pattern '.py' in my file and print the word which contains. For example: cat testfile a b 3 4.py 5 6 a b.py c.py 4 5 6 7 8 1.py 2.py 3 4 5 6 Expected output: 4.py b.py c.py 1.py 2.py (3 Replies)
Discussion started by: Sumanthsv
3 Replies
DROP TEXT SEARCH 
DICTIONARY(7) SQL Commands DROP TEXT SEARCH DICTIONARY(7) NAME
DROP TEXT SEARCH DICTIONARY - remove a text search dictionary SYNOPSIS
DROP TEXT SEARCH DICTIONARY [ IF EXISTS ] name [ CASCADE | RESTRICT ] DESCRIPTION
DROP TEXT SEARCH DICTIONARY drops an existing text search dictionary. To execute this command you must be the owner of the dictionary. PARAMETERS
IF EXISTS Do not throw an error if the text search dictionary does not exist. A notice is issued in this case. name The name (optionally schema-qualified) of an existing text search dictionary. CASCADE Automatically drop objects that depend on the text search dictionary. RESTRICT Refuse to drop the text search dictionary if any objects depend on it. This is the default. EXAMPLES
Remove the text search dictionary english: DROP TEXT SEARCH DICTIONARY english; This command will not succeed if there are any existing text search configurations that use the dictionary. Add CASCADE to drop such con- figurations along with the dictionary. COMPATIBILITY
There is no DROP TEXT SEARCH DICTIONARY statement in the SQL standard. SEE ALSO
ALTER TEXT SEARCH DICTIONARY [alter_text_search_dictionary(7)], CREATE TEXT SEARCH DICTIONARY [create_text_search_dictionary(7)] SQL - Language Statements 2010-05-14 DROP TEXT SEARCH DICTIONARY(7)
All times are GMT -4. The time now is 09:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy