Sponsored Content
Full Discussion: How to grep this pattern??
Top Forums Shell Programming and Scripting How to grep this pattern?? Post 302168987 by askumarece on Wednesday 20th of February 2008 01:43:06 AM
Old 02-20-2008
Yeah I tried.... But it is ignoring the lines which are being stored with tab insteadof space.....
for eg:
if i have the following lines in my file :
package com.att.iom; line 1
[space][space]package com.att.iom; line 2
[space] package com.att.iom; line 3
[space][space][space][space] package com.att.iom; line 4
something package com.att.iom;..... ##but I don't need this line line 5
[tab][tab]package com.att.iom; line 6 Here No space at begining of the line
something something package com.att.iom;##but I don't need this line line 7
package com.att.iom; line8

here is the o/p while I run this grep cmd:
---------------------------------
sa156s@::/export/home/sa156s> grep '^[ \t]*package com.att.iom;' file
package com.att.iom; line 1
package com.att.iom; line 2
package com.att.iom; line 3
package com.att.iom; line 4
package com.att.iom; line8
---------------------------------
it is ignoring the line #:6, but how to grep including that one also......


Saravana
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to grep the pattern ?

how to grep the pattern ? How can I grep or find the pattern from this files in the directory. I have couple of ascii files too.I have to grep the binary files.Please assist me Thanks Francis (2 Replies)
Discussion started by: faviji
2 Replies

2. Shell Programming and Scripting

how to grep certain pattern

-Hi I have a file with the following entries: tschkback12 tschkback11 tschkback15 tschkback28 ....etc. I need to grep all the lines out of this file which end with the number (just "tschkback" should be excluded). Can it be done with one line command? Thanks -A (5 Replies)
Discussion started by: aoussenko
5 Replies

3. Shell Programming and Scripting

Want to grep for a pattern and display the content above that pattern

Hi, When we have a failure, sometimes we just step restart the job from the next step. Later when we open the log for analysis of the failure, it is becoming difficult to go to the failure part. For eg., if it is a 1000 line log, the failure may be at 500th line. so wat i want to do is, grep... (6 Replies)
Discussion started by: ajayakunuri
6 Replies

4. Emergency UNIX and Linux Support

Grep pattern

I have to search from millions of lines of code of lines having following pattern: get_token , get_token For example: fn1(string.get_token(), string1.get_token()); Thanks in advance (5 Replies)
Discussion started by: uunniixx
5 Replies

5. Shell Programming and Scripting

Grep the word from pattern line and update in subsequent lines till next pattern line reached

Hi, I have got the below requirement. please suggest. I have a file like, Processing Item is: /data/ing/cfg2/abc.txt /data/ing/cfg3/bgc.txt Processing Item is: /data/cmd/for2/ght.txt /data/kernal/config.klgt.txt I want to process the above file to get the output file like, ... (5 Replies)
Discussion started by: rbalaj16
5 Replies

6. Shell Programming and Scripting

How to Grep than scan line below grep pattern

Hello Colleagues, I have a file that looks like below. 6-12731913-12731913 9230760143480 410018547148230 20131002193434+0500 20131002193434+0500 ;20131002T161031000-10.50.241.21-21912131-1419034760, ver: 0 20131009 92220056296730 CC0P abc Core_Context_R1A SMS 6-12726796-12726796... (14 Replies)
Discussion started by: umarsatti
14 Replies

7. Shell Programming and Scripting

sed and awk usage to grep a pattern 1 and with reference to this grep a pattern 2 and pattern 3

Hi , I have a file where i have modifed certain things compared to original file . The difference of the original file and modified file is as follows. # diff mir_lex.c.modified mir_lex.c.orig 3209c3209 < if(yy_current_buffer -> yy_is_our_buffer == 0) { --- >... (5 Replies)
Discussion started by: breezevinay
5 Replies

8. Shell Programming and Scripting

Grep lines before a pattern having some other pattern

Hi All, I am trying to fetch lines before a pattern, I got to know about -B flag in grep but we have to pass the number to get those lines before some pattern say (X), now what if I want to get line/s with some other pattern say (Y) before X pattern? How to get about it? please help. Input:... (5 Replies)
Discussion started by: dips_ag
5 Replies

9. UNIX for Dummies Questions & Answers

Grep -v lines starting with pattern 1 and not matching pattern 2

Hi all! Thanks for taking the time to view this! I want to grep out all lines of a file that starts with pattern 1 but also does not match with the second pattern. Example: Drink a soda Eat a banana Eat multiple bananas Drink an apple juice Eat an apple Eat multiple apples I... (8 Replies)
Discussion started by: demmel
8 Replies

10. UNIX for Beginners Questions & Answers

Grep/awk using a begin search pattern and end search pattern

I have this fileA TEST FILE ABC this file contains ABC; TEST FILE DGHT this file contains DGHT; TEST FILE 123 this file contains ABC, this file contains DEF, this file contains XYZ, this file contains KLM ; I want to have a fileZ that has only (begin search pattern for will be... (2 Replies)
Discussion started by: vbabz
2 Replies
NDB(8)							      System Manager's Manual							    NDB(8)

NAME
query, mkhash, mkdb, cs, csquery, dns, dnsquery - network database SYNOPSIS
ndb/query attr value [ rattr ] ndb/mkhash file attr ndb/cs [ -n ] [ -f dbfile ] ndb/csquery ndb/dns [ -s ] [ -f dbfile ] ndb/dnsquery ndb/mkdb DESCRIPTION
The network database holds administrative information used by network programs such as bootp(8), ipconfig(8), con(1), etc. Ndb/query searches the database for an attribute of type attr and value value. If rattr is not specified, all entries matched by the search are returned. If rattr is specified, the value of the first pair with attribute rattr of all the matched entries is returned. Ndb/mkhash creates a hash file for all entries with attribute attr in database file file. The hash files are used by ndb/query and by the ndb library routines. Ndb/cs is a server used by dial(2) to translate network names. Option -f supplies the name of the data base file to use, default /lib/ndb/local. It is started at boot time. It finds out what networks are configured by looking for /net/*/clone when it starts. It can also be told about networks by writing to /net/cs a message of the form: add net1 net2 ... Ndb/cs also sets the system name in /dev/sysname if it can figure it out. Option -n causes cs to do nothing but set the system name. Ndb/csquery can be used to query ndb/cs to see how it resolves addresses. Ndb/csquery prompts for addresses and prints out what ndb/cs returns. Ndb/dns is a server used by ndb/cs and by remote systems to translate Internet domain names. Ndb/dns is started at boot time. By default dns serves only requests written to /net/dns. Option -s causes the server to also answer domain requests sent to UDP port 53. Name reso- lution is performed by searching the local database and by querying remote servers. The server for a domain is indicated by a database entry containing both a dom and a ns attribute. For example, the entry for the Internet root is: dom= ns=ns.nic.ddn.mil ns=kava.nisc.sri.com ns=aos.brl.mil The root of a domain subtree served by the local database is indicated by an entry with an soa attribute. For example, the AT&T research domain is: dom=research.att.com soa mb=ches.research.att.com ns=inet.research.att.com ns=research.research.att.com Here, the mb entry is the mail address of the person responsible for the domain (default postmaster). Wild-carded domain names can also be used. For example, to specify a mail forwarder for all AT&T research systems: dom=*.research.att.com mx=research.att.com Ndb/dnsquery can be used to query ndb/dns to see how it resolves requests. Ndb/dnsquery prompts for commands of the form domain-name request-type where request-type can be ip, mx, ns, cname, ptr.... In the case of the inverse query type, ptr, dnsquery will reverse the ip address and tack on the .in-addr.arpa for you. Ndb/mkdb is used in concert with awk(1) scripts to convert uucp systems files, IP host files, and Datakit configuration files into database files. It is very specific to the situation at Murray Hill. When the database files change underfoot, ndb/cs and ndb/dns track them properly. Nonetheless, to keep the database searches efficient it is necessary to run ndb/mkhash whenever the files are modified. It may be profitable to control this by a frequent cron(8) job. EXAMPLES
% ndb/query sys helix sys=helix dom=helix.research.att.com bootf=/mips/9powerboot ip=135.104.117.31 ether=080069020427 dk=nj/astro/helix proto=il % ndb/query sys helix ip 135.104.117.31 % ndb/dnsquery > 9net.research.att.com ip 9net.research.att.com ip 192.20.225.252 > 192.20.225.252 ptr 252.225.20.192.in-addr.arpa ptr 9net.research.att.com > FILES
/lib/ndb/local first database file searched /lib/ndb/local.* hash files for /lib/ndb/local /srv/cs service file for ndb/cs /net/cs where /srv/cs gets mounted /srv/dns service file for ndb/dns /net/dns where /srv/dns gets mounted SOURCE
/sys/src/cmd/ndb SEE ALSO
ndb(2) ndb(6) NDB(8)
All times are GMT -4. The time now is 01:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy