Sponsored Content
Full Discussion: Help needed in search string
Top Forums UNIX for Dummies Questions & Answers Help needed in search string Post 302146737 by amitrajvarma on Thursday 22nd of November 2007 04:16:29 AM
Old 11-22-2007
Hi Bak,

Thanks for the info. I did not follow the above...

I have a file called buildlog.txt and I need to look for a particular strings
(for example)

In buildlog.txt
I am looking for string "image1" and "image2"

If the string "image1" and "image2" is found then pass it into a file1.txt
if only string "image1" & no string "image2" found then pass string "image1" to file1.txt and pass the string "image2" to file2.txt

How can I do it?

Thx

Amit
 

9 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

Search, replace string in file1 with string from (lookup table) file2?

Hello: I have another question. Please consider the following two sample, tab-delimited files: File_1: Abf1 YKL112w Abf1 YAL054c Abf1 YGL234w Ace2 YKL150w Ace2 YNL328c Cup9 YDR441c Cup9 YDR442w Cup9 YEL040w ... File 2: ... ABF1 YKL112W ACE2 YLR131C (9 Replies)
Discussion started by: gstuart
9 Replies

3. Shell Programming and Scripting

Printing 10 lines above and below the search string: help needed

Hi, The below code will search a particular string(say false in this case) and return me 10 lines above and below the search string in a file. " awk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r;print("***********************************");print;c=a;}b{r=$ 0}' b=10 a=10 s="false" " ... (5 Replies)
Discussion started by: vimalm22
5 Replies

4. Shell Programming and Scripting

Help needed :Search and Replace a string pattern with empty in an xml file in unix

Search and Replace a string pattern with empty in an xml file in unix: My xml file would be like this : <Accounts><Name>Harish</Name><mobile>90844444444444445999 </mobile><TRIG>srcujim-1</TRIG></Accounts><Accounts><Name>Satish</Name><mobile>908999</mobile><TRIG>ettertrtt-1</TRIG></Accounts> ... (1 Reply)
Discussion started by: harish_s_ampeo
1 Replies

5. 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

6. Shell Programming and Scripting

Search one string and then search another string in the next line

I am unable to use grep comman to Print only EmpPosition and if the EmpID next line. So output should be both EmpPosition and EmpID and also EmpPosition and EmpID data should match. Sample Data EmpPosition "New" EmpID "New" - - EmpPosition "New" ... (4 Replies)
Discussion started by: onesuri
4 Replies

7. 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

8. UNIX for Beginners Questions & Answers

Search a string and display its location on the entire string and make a text file

I want to search a small string in a large string and find the locations of the string. For this I used grep "string" -ob <file name where the large string is stored>. Now this gives me the locations of that string. Now how do I store these locations in a text file. Please use CODE tags as... (7 Replies)
Discussion started by: ANKIT ROY
7 Replies

9. 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
IMAGECOLORMATCH(3)							 1							IMAGECOLORMATCH(3)

imagecolormatch - Makes the colors of the palette version of an image more closely match the true color version

SYNOPSIS
bool imagecolormatch (resource $image1, resource $image2) DESCRIPTION
Makes the colors of the palette version of an image more closely match the true color version. PARAMETERS
o $image1 - A truecolor image link resource. o $image2 - A palette image link resource pointing to an image that has the same size as $image1. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 imagecolormatch(3) example <?php // Setup the true color and palette images $im1 = imagecreatefrompng('./gdlogo.png'); $im2 = imagecreate(imagesx($im1), imagesy($im1)); // Add some colors to $im2 $colors = Array(); $colors[] = imagecolorallocate($im2, 255, 36, 74); $colors[] = imagecolorallocate($im2, 40, 0, 240); $colors[] = imagecolorallocate($im2, 82, 100, 255); $colors[] = imagecolorallocate($im2, 84, 63, 44); // Match these colors with the true color image imagecolormatch($im1, $im2); // Free from memory imagedestroy($im1); imagedestroy($im2); ?> NOTES
Note This function requires GD 2.0.1 or later (2.0.28 or later is recommended). SEE ALSO
imagecreatetruecolor(3). PHP Documentation Group IMAGECOLORMATCH(3)
All times are GMT -4. The time now is 05:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy