Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Searching for multiple words on a line in any order issue Post 302517893 by semaj on Thursday 28th of April 2011 04:55:26 AM
Old 04-28-2011
Hi

Sorry for the late reply, I have been busy.

You help sort of works. But the issue now is that I can view multiple days, but if I want to match say, Tue with Mar and 2008, it shows all Tue results, all Mar results, and all 2008 results, which is not what I need:

Code:
1.13.233.120       Sat Mar 01 14:10:29 GMT 2008
1.10.223.120       Tue Sep 27 12:30:55 GMT 2007
1.10.223.120       Tue Sep 24 13:09:10 GMT 2007
1.10.223.120       Tue May 19 01:17:30 GMT 2008
1.10.223.120       Tue May 16 08:15:31 GMT 2008

Code:
cat file | grep -E "$OPTION1|$OPTION2|OPTION3"

I want it so it should display Tue with Mar and 2008 on the same line (as in the first post) but be able to search for multiple days, months or years also. So Mon, Tue, Mar, 2008 would show Mondays and Tuesdays in March and 2008.

Sorry I should have made this clearer at the beginning.

Last edited by semaj; 04-28-2011 at 06:06 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

compare strings, words in different order

Hi, Would anyone know how to compare two strings, and only throw an error if there were different words, not that the same words were in a different order? e.g "A B C" vs "B C A" ->OK "A B C" vs "A D C" -> BAD Thanks! (2 Replies)
Discussion started by: rebelbuttmunch
2 Replies

2. UNIX for Dummies Questions & Answers

Perl searching and printing multiple target in the same line

Hello, I'm trying to create a program in perl called myfind.pl; To use the program: (at the command line)$ program.pl keyword filename note: the keyword is any word or regular expression and it should display the result just like when you 'cat' the file name but with the keyword in... (2 Replies)
Discussion started by: Horizon666
2 Replies

3. Shell Programming and Scripting

grep multiple words in a single line

Hi.. How to search for multiple words in a single line using grep?. Eg: Jack and Jill went up the hill Jack and Jill were best friends Humpty and Dumpty were good friends too ---------- I want to extract the 2nd statement(assuming there are several statements with... (11 Replies)
Discussion started by: anduzzi
11 Replies

4. Shell Programming and Scripting

Keep lines with specific words up in an order

I hava a file with following data: number|CREDIT_ID|NULL date|SYS_CREATION_DATE|NULL varchar2|GGS_COMMIT_CHAR|NULL varchar2|GGS_OP_TYPE|NULL number|GGS_SCN|NULL| number|GGS_LOG_SEQ|NULL number|GGS_LOG_POS|NULL number|GGS_ORACREC_SCN|NULL varchar2|BATCH_ID|NULL char|GGS_IMAGE_TYPE|NULL ... (6 Replies)
Discussion started by: kolesunil
6 Replies

5. Shell Programming and Scripting

awk script to get words which are not in a particula order

Hi all, I need a big help. I've a requirment which should be done in awk scripting only.. My requirment is: In below file, there are some lines started with 'master replica:'. i want to get the exact word in that line which should be before '@', and i've to create a file with these names... (5 Replies)
Discussion started by: raghu.iv85
5 Replies

6. Shell Programming and Scripting

Perl, searching multiple files and printing returned line to new file

I am trying to find a way to utilise the full potential of my cpu cores and memory on my windows machine. Now, I am quite familiar with grep, however, running a Unix based OS is not an option right now. Unfortunately, the 32 bit grep for windows that I am running, I cannot run multiple... (1 Reply)
Discussion started by: Moloch
1 Replies

7. Shell Programming and Scripting

Multiple Interval cron issue with order of execution

55,0 5,6 * * * myScript This cron task will execute on 5:00AM, 5:55AM, 6:00AM and 6:55AM. Is there any possibility to make it run only in the order specified such as 5:55AM and 6:00AM (basically only on the 2 intervals) ? (1 Reply)
Discussion started by: vikram3.r
1 Replies

8. Shell Programming and Scripting

sed - searching token in certain order

Hello. I would like to write a bash function which would return "true" if the search succeed else return anything else. something like if ] ; then exit 1 fi function my_funct () { find first occurrence $2 in $1 if not found return "false" from that position,... (6 Replies)
Discussion started by: jcdole
6 Replies

9. Shell Programming and Scripting

USING sed to remove multiple strings/words from a line

Hi I use sed comnand to remove occurance of one workd from a line. However I need to removed occurance of dufferent words in ne line. Original-1 Hi this is the END of my begining Comand sed s/"END"/"start"/g Output-1 Hi this is the start of my beginig But I have more... (9 Replies)
Discussion started by: mnassiri
9 Replies

10. Shell Programming and Scripting

Search words in multiple file line by line

Hi All I have to search servers name say like 1000+ "unique names" line by line in child.txt files in another file that is a master file where all server present say "master.txt",if child.txt's server name matches with master files then it print yes else no with server name. (4 Replies)
Discussion started by: netdbaind
4 Replies
LOOK(1) 						      General Commands Manual							   LOOK(1)

NAME
look - find lines in a sorted list SYNOPSIS
look [ -dfnixtc ] [ string ] [ file ] DESCRIPTION
Look consults a sorted file and prints all lines that begin with string. It uses binary search. The following options are recognized. Options dfnt affect comparisons as in sort(1). -i Interactive. There is no string argument; instead look takes lines from the standard input as strings to be looked up. -x Exact. Print only lines of the file whose key matches string exactly. -d `Directory' order: only letters, digits, tabs and blanks participate in comparisons. -f Fold. Upper case letters compare equal to lower case. -n Numeric comparison with initial string of digits, optional minus sign, and optional decimal point. -t[c] Character c terminates the sort key in the file. By default, tab terminates the key. If c is missing the entire line comprises the key. If no file is specified, /lib/words is assumed, with collating sequence df. FILES
/lib/words SOURCE
/sys/src/cmd/look.c SEE ALSO
sort(1), grep(1) DIAGNOSTICS
The exit status is "not found" if no match is found, and "no dictionary" if file or the default dictionary cannot be opened. LOOK(1)
All times are GMT -4. The time now is 10:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy