Conditional string search

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Conditional string search
# 1  
Old 01-13-2014
Conditional string search

Hi, I need to search/grep userid and its value based on a condition that the user id is under the heading "*central_test*" in a big file of about 70808MB. The * represents some strings before and after the string "centrla_test". Could anyone please guide. OS is hp-ux.
# 2  
Old 01-13-2014
Please provide an example of input file format as well as output expected : people will then be able to provide a more accurate answer.
# 3  
Old 01-13-2014
Hi ctsgnb, the only constraint is that itz a config file of an appln which i'm not supposed to reveal. I'm really sorry; i'm constrained.
I tried with $grep "<user_id>" <file_name>. but this didn't work.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to use a grep search to search for a specific string within multiple directories?

Lets say I have a massive directory which is filled with other directories all filled with different c++ scripts and I want a listing of all the scripts that contain the string: "this string". Is there a way to use a grep search for that? I tried: grep -lr "this string" * but I do not... (3 Replies)
Discussion started by: Circuits
3 Replies

2. Shell Programming and Scripting

Search string within a file and list common words from the line having the search string

Hi, Need your help for this scripting issue I have. I am not really good at this, so seeking your help. I have a file looking similar to this: Hello, i am human and name=ABCD. How are you? Hello, i am human and name=PQRS. I am good. Hello, i am human and name=ABCD. Good bye. Hello, i... (12 Replies)
Discussion started by: royzlife
12 Replies

3. Shell Programming and Scripting

Search several string and convert into a single line for each search string using awk command AIX?.

I need to search the file using strings "Request Type" , " Request Method" , "Response Type" and by using result set find the xml tags and convert into a single line?. below are the scenarios. Cat test Nov 10, 2012 5:17:53 AM INFO: Request Type Line 1.... (5 Replies)
Discussion started by: laknar
5 Replies

4. Shell Programming and Scripting

Conditional Search/Replace

I'm looking for an awk or (preferably) sed solution to search a pipe delimited file for any occurrence of an email address that does not include a designed domain, and replace the email address with a blank. E.g. hello|||1234| turns into: ... (2 Replies)
Discussion started by: tiggyboo
2 Replies

5. Shell Programming and Scripting

Conditional grep command to search entire file

Let me give you a complete example what I am trying to achieve. 1. Below is the log file structure where I need 2,5 and 14th column of the logs after grepping through the linkId=1ddoic. Log file structure:- 20120829001415 app none11111 sas 0 0 N clk Mozilla/5.0... (3 Replies)
Discussion started by: kmajumder
3 Replies

6. Shell Programming and Scripting

search and conditional execution

Hi, I have a list of files with different filenames like nam0001.txt,pan0001.txt etc coming in /data/inbox from various places. I needed a shell script which would:- 1)searches for a word from the filenames (coming in inbox directory) provided in input parameter. 2)if found, put in... (2 Replies)
Discussion started by: Saiesh
2 Replies

7. Shell Programming and Scripting

Conditional search and delete using SED / Shell script

Hi, I want to perform a conditional search and remove my search string. Input string: "abcdaabcadgfaarstab" Character to search: "a" Condition: Remove all "a" in the input string except if it is "aa" Output string: "bcdaabcdgfaarstb" Can you please help me in this? (5 Replies)
Discussion started by: dominiclajs
5 Replies

8. Shell Programming and Scripting

conditional multiple string matching

I need to print fileNames that contains multiple search strings conditionally. Condition: Any file in the folder that has search strings ---> (b1b && d1d) && ( a1a || c1c ). i.e File should have both (b1b AND d1d) AND (either a1a or c1c). Where && is logical AND || is logical OR. ... (10 Replies)
Discussion started by: kchinnam
10 Replies

9. Shell Programming and Scripting

sed conditional string replace for each line

Hi all, I appreciate the enormous amount of knowledge that flows in this forum. I am an average UNIX user. I have many files with lines like the below. I have separated each line with space for ease of reading. I need to replace the first occurance of "/00" with null on those lines that have... (6 Replies)
Discussion started by: Nanu_Manju
6 Replies

10. Shell Programming and Scripting

Perl: Search for string on line then search and replace text

Hi All, I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text. An example of 4 lines in my file is: 1. MatchText_randomNumberOfText moreData ReplaceMe moreData 2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Discussion started by: Crypto
4 Replies
Login or Register to Ask a Question