AND connection of a Search request


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting AND connection of a Search request
# 1  
Old 11-09-2009
AND connection of a Search request

hi, i need a command to connect two conditions

e.g.
Code:

grep -i wort1 *.doc | grep -i wort2

but in one grep command

I search in the file wus.txt with an offset. After letter 4 the word "mueller" and after the letter 13 the word "test":

OR-connection
Code:
/usr/xpg4/bin/grep "("^.\{4\}mueller"|"^.\{13\}test")" wus.txt


I NEED A AND-CONNECTION OF THIS SEARCH REQUEST
# 2  
Old 11-09-2009
Quote:
Originally Posted by Timmää
Code:
"("^.\{4\}mueller"|"^.\{13\}test")"

Code:
"("^....mueller..test")"

Just a guess, though Smilie
# 3  
Old 11-09-2009
Quote:
Originally Posted by Timmää
hi, i need a command to connect two conditions

e.g.
Code:

grep -i wort1 *.doc | grep -i wort2

but in one grep command

I search in the file wus.txt with an offset. After letter 4 the word "mueller" and after the letter 13 the word "test":

OR-connection
Code:
/usr/xpg4/bin/grep "("^.\{4\}mueller"|"^.\{13\}test")" wus.txt


I NEED A AND-CONNECTION OF THIS SEARCH REQUEST
Try awk:

Code:
/usr/xpg4/bin/awk 'substr($0,5)~"^mueller" && substr($0,14)~"^test"'

# 4  
Old 11-10-2009
Quote:
Originally Posted by Franklin52
Try awk:

Code:
/usr/xpg4/bin/awk 'substr($0,5)~"^mueller" && substr($0,14)~"^test"'

ok.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Red Hat

Is connection possible without ping request

I have a question which is conceptual in nature, is it possible to receive traffic from a remote host to my host machine even if the ping from host to remote machine is not happening in Linux( Red Hat). I hope my question is clear that is it possible for a connection to happen from a host to... (1 Reply)
Discussion started by: RHCE
1 Replies

2. Linux

Bash to append domain in search field of resolv.conf after vpnc connection in Linux

After vpn connection,I am not able to resolve any machines in remote gateway.It looks like remote domain is added to domain field instead of adding it to the Search field in /etc/resolv.conf I want the remote domain to add to search field along with local domain.Can anyone tell a bash or script... (2 Replies)
Discussion started by: jeremy_brett
2 Replies

3. UNIX for Advanced & Expert Users

How keep running a program n an another computer via a connection ssh when the connection is closed?

Hi everybody, I am running a program on a supercomputer via my personal computer through a ssh connection. My program take more than a day to run, so when I left work with my PC I stop the connection with the supercomputer and the program stop. I am wondering if someone know how I can manage... (2 Replies)
Discussion started by: TomTomGre
2 Replies

4. Shell Programming and Scripting

Urgent request to consider:Search specific name in a file and fetch specific entries

Hi all, I have 2 files, One file contain data like this FHIT CS CHRM1 PDE3A PDE3B HSP90AA1 PTK2 HTR1A ESR1 PARP1 PLA2G1B These names are mentioned in the second file(Please see attached second file) as # Drug_Target_X_Gene_Name:(Where X can be any number (1-1000) (1 Reply)
Discussion started by: manigrover
1 Replies

5. Solaris

Solaris 10 ftp connection problem (connection refused, connection timed out)

Hi everyone, I am hoping anyone of you could help me in this weird problem we have in 1 of our Solaris 10 servers. Lately, we have been having some ftp problems in this server. Though it can ping any server within the network, it seems that it can only ftp to a select few. For most servers, the... (4 Replies)
Discussion started by: labdakos
4 Replies

6. UNIX for Advanced & Expert Users

Connection reset by peer..closing connection

Hello I'm facing the above problem while doing a performance run. I've a script which I'm launching from my windows desktop using mozilla. The script will invoke backend action on a Solaris host which in turn feeds the records to a driver located on a linux box(Cent OS). What's happening is... (1 Reply)
Discussion started by: subramanyab
1 Replies

7. UNIX for Dummies Questions & Answers

ssh_exchange_identification: Connection closed by remote host Connection closed

Hi Everyone, Good day. Scenario: 2 unix servers -- A (SunOS) and B (AIX) I have an ftp script to sftp 30 files from A to B which happen almost instantaneously i.e 30 sftp's happen at the same time. Some of these sftp's fail with the following error: ssh_exchange_identification: Connection... (1 Reply)
Discussion started by: jeevan_fimare
1 Replies

8. HP-UX

URGENT HELP REQUEST!!!!Connection problem between HP3000 and HP9000

Hi, I am facing some problem in connecting the database(allbase) present on HP3000 through pro c programmin language that is being executed from HP 9000 machine could any one of you please help me!!! when i run the code on HP9000 machine it is connecting to database(access the local host)... (0 Replies)
Discussion started by: ahmedwaseem2000
0 Replies
Login or Register to Ask a Question