Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Filter file according to pattern Post 302442931 by akashtcs on Friday 6th of August 2010 02:25:54 AM
Old 08-06-2010
Filter file according to pattern

Hello

I have an input file which is tab delimited.In my unix script I have search for a particular pattern.If it is NOT present then I have to write in an output file.
Eg.Input file is :
Code:
123  hello 7779 hi hkjh88 hahah
678  hello 90845 ti hkjsdfh 9324

And the search string is "123 hello hi".If all these are present in the particular line then the line should not be written to the output file.All other lines should be written.The output file will look like:
Code:
678  hello 90845 ti hkjsdfh 9324

The fields are present at fixed position of the tab-delimited line.In the above ex 1,2 and 4.
Plz help
Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Urgent! Sed/Awk Filter Find Pattern Delete Till End Of Line

Hi, I need help with using an awk or sed filter on the below line ALTER TABLE "ACCOUNT" ADD CONSTRAINT "ACCOUNT_PK" PRIMARY KEY ("ACCT_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "WMC_DATA" LOGGING ENABLE Look for... (2 Replies)
Discussion started by: rajan_san
2 Replies

2. Shell Programming and Scripting

To filter a certain pattern depending on neighbour

Hi, As I am new to filtering section of Unix I am facing a problem I have following lines in text file : Created RELEASE in dist/Apple_release_1_0_.zip Created RELEASE in dist/Banana_release_1_0_.zip Created RELEASE in dist/Mango_release_1_0_.zip Created RELEASE in... (2 Replies)
Discussion started by: bhaskar_m
2 Replies

3. Shell Programming and Scripting

Filter a .kml file (xml) with data set from text file

I have a .kml file. So I want filter the .kml to get only the tags that have this numeric codes that they are in a text file 11951 11952 74014 11964 11965 11969 11970 11971 11972 60149 74018 74023 86378 11976 11980 11983 11984 11987 (5 Replies)
Discussion started by: pcoj33
5 Replies

4. Shell Programming and Scripting

Search for a pattern in a String file and count the occurance of each pattern

I am trying to search a file for a patterns ERR- in a file and return a count for each of the error reported Input file is a free flowing file without any format example of output ERR-00001=5 .... ERR-01010=10 ..... ERR-99999=10 (4 Replies)
Discussion started by: swayam123
4 Replies

5. Shell Programming and Scripting

Need help in a script to filter specific pattern

Hello , Below is the command srvctl config database -d cmdbut -s boms10.world Below is the output. Now in the command instead of cmdbut it will be a variable like $database which would be called in the script as below: srvctl config database -d $database -s $service Now,as shown in... (6 Replies)
Discussion started by: Vishal_dba
6 Replies

6. UNIX for Dummies Questions & Answers

Filter records in a huge text file from a filter text file

Hi Folks, I have a text file with lots of rows with duplicates in the first column, i want to filter out records based on filter columns in a different filter text file. bash scripting is what i need. Data.txt Name OrderID Quantity Sam 123 300 Jay 342 498 Kev 78 2500 Sam 420 50 Vic 10... (3 Replies)
Discussion started by: tech_frk
3 Replies

7. Shell Programming and Scripting

sed - filter blocks between single delimiters matching a pattern

Hi! I have a file with the following format:CDR ... MSISDN=111 ... CDR ... MSISDN=xxx ... CDR ... MSISDN=xxx ... CDR ... MSISDN=111 (2 Replies)
Discussion started by: Flavius
2 Replies

8. Shell Programming and Scripting

Big pattern file matching within another pattern file in awk or shell

Hi I need to do a patten match between files . I am new to shell scripting and have come up with this so far. It take 50 seconds to process files of 2mb size . I need to tune this code as file size will be around 50mb and need to save time. Main issue is that I need to search the pattern from... (2 Replies)
Discussion started by: nitin_daharwal
2 Replies

9. Shell Programming and Scripting

Shell script to filter records in a zip file that contains matching columns from another file

Not sure if this is the correct forum for this question. I have two files. file1.zip, file2 Input: file1.zip col1, col2 , col3 a , b , 0:0:0:0:0:c436:9346:d40b x, y, 0:0:0:0:0:880:39f9:c9a7 m, n , 0:0:0:0:0:80c7:9161:fe00 file2.txt col1 c4:36:93:46:d4:0b... (1 Reply)
Discussion started by: anil.v
1 Replies

10. Shell Programming and Scripting

Filter pattern in grep command

Hi, I am having a file like below hello how are you hello... (5 Replies)
Discussion started by: rohit_shinez
5 Replies
copt(1) 							z88 Development Kit							   copt(1)

NAME
copt - peephole optimizer SYSNOPIS
copt file ... DESCRIPTION
copt is a general-purpose peephole optimizer. It reads code from its standard input and writes an improved version to its standard output. copy reads the named files for its optimizations, which are encoded as follows: <pattern for input line 1> <pattern for input line 2> ... <pattern for input line n> = <pattern for output line 1> <pattern for output line 2> ... <pattern for output line m> <blank line> Pattern matching uses literal string comparison, with one exception: ``%%'' matches the ``%'' character, and ``%'' followed by a digit matches everything up to the next occurrence of the next pattern character, though all occurrences of %n must denote the same string. For example, the pattern ``%1=%1.'' matches exactly those strings that begin with a string X, followed by a ``='' (the first), followed by a second occurrence of X, followed by a period. In this way, the input/output pattern mov $%1,r%2 mov *r%2,r%2 = mov %1,r%2 commands copt to replace runs like mov $_a,r3 mov *r3,r3 with mov _a,r3 Note that a tab or newline can terminate a %n variable. copt compares each run of input patterns with the current input instruction and its predecessors. If no match is found, it advances to the next input instruction and tries again. Otherwise, it replaces the input instructions with the corresponding output patterns, pattern vari- ables instantiated,and resumes its search with the first instruction of the replacement. copt matches input patterns in reverse order to cascade optimizations without backing up. BUGS
Errors in optimization files are always possible. SEE ALSO
z88dk(1), z88dk-zcc(1), z88dk-z80asm(1), z88dk-appmake(1), z88dk-copt(1). AUTHOR
z88dk was written by Dominic Morris <dom@z88dk.org>, and others. 01 December 2009 copt(1)
All times are GMT -4. The time now is 04:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy