Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Search partial string in a file and replace the string - UNIX Post 303040886 by sarathy_a35 on Friday 8th of November 2019 07:13:34 AM
Old 11-08-2019
@Rudic : I am looking for solution for both the scenario's.

--- Post updated at 12:13 PM ---

@Rudic : For scenario-1, it is not working as expected. Instead of comparing the existing one, it is appending the strings in first line.

For scenario-2 which you have said initially worked partially. i.e. For partially matching pattern it updated with new strings which we passed as Input parameter. If the complete strings is not matched then it has to be added to the file as new record which doesn't work.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search for a string and replace the searched string in the same position

Hi All, My requisite is to search for the string "0108"(which is the year and has come in the wrong year format) in a particular column say 4th column in a tab delimited file and then replace it with 2008(the correct year format) in the same position where 0108 was found..The issue is the last... (15 Replies)
Discussion started by: ganesh_248
15 Replies

2. UNIX for Dummies Questions & Answers

Search for a string and replace the searched string in the same position in samefile

Hi All, My requisite is to search for the string "0108"(which is the year and has come in the wrong year format) in a particular column say 4th column in a tab delimited file and then replace it with 2008(the correct year format) in the same position where 0108 was found in the same file..The... (27 Replies)
Discussion started by: ganesh_248
27 Replies

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

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. UNIX for Dummies Questions & Answers

Search a string in the file and then replace another string after that position

Hi I am looking for a particular string in a file.If the string exists, then I want to replace another string with some other text.Once replaced, search for the same text after that character position in the file. :wall: E.g: Actual File content: Hello Name: Nitin Raj Welcome to Unix... (4 Replies)
Discussion started by: dashing201
4 Replies

6. Shell Programming and Scripting

How to replace partial string

I have a list of strings in file: 10 10 AAA 120 13 BBBBB 23 11 CCCCC 11 32 DDDDDD I want to replace first column of the text such as: 10, 129, 23, 11 with 11, 22, 33, 44. I can do line by line, but just not sure how to replace partial string without... (1 Reply)
Discussion started by: ford99
1 Replies

7. Shell Programming and Scripting

Search for a string in a file and replace

I have file t1.log Contents of t1.log file Number of records processed: Number of records rejected: Error : xyz .......... abc .......... aaa _] start time : end time : Please let me know how i can remove the contents highlighted in red in the t1.log file. Thanks Sam (3 Replies)
Discussion started by: sam777
3 Replies

8. Shell Programming and Scripting

How to replace partial of string in file?

Hi Guys, I need replace part of string in a file. for example: ABC=123 CDE=122 DEF=456 ABC=123 DED=333 ABC=123 I need replace the value after ABC=, highlighted in red. I want to get following result; ABC=456 CDE=122 DEF=456 ABC=456 DED=333 ABC=456 Anybody can help me this. ... (8 Replies)
Discussion started by: ken6503
8 Replies

9. UNIX for Dummies Questions & Answers

Search for a string,delete the line and replace with new string in a file

Hi Everyone, I have a requirement in ksh where i have a set of files in a directory. I need to search each and every file if a particular string is present in the file, delete that line and replace that line with another string expression in the same file. I am very new to unix. Kindly help... (10 Replies)
Discussion started by: Pradhikshan
10 Replies
gnome-search-tool(1)						   User Commands					      gnome-search-tool(1)

NAME
gnome-search-tool - search for files SYNOPSIS
gnome-search-tool [--named=text] [--path=folder] [--sortby=order] [--descending] [--contains=string] [--user=user] [--nouser] [--allmounts] [--empty] [--follow] [--group=group] [--hidden] [--mtimeless=date] [--mtimemore=date] [--notnamed=filename] [--regex=pattern] [--size- less=size] [--sizemore=size] [--start] [gnome-std-options] DESCRIPTION
The Search for Files application enables you to search for files on your system. Search for Files uses the find(1) command. OPTIONS
The following options are supported: --allmounts Select the 'Search other filesystems' search constraint. --contains=string Select the 'Contains the text' search constraint and set the text of that entry. Use a full filename or a partial filename with wildcards. See find(1) for more details about using wildcards. --descending Set sort order to descending. The default sort order is ascending. --empty Select the 'File is empty' search constraint. --follow Select the 'Follow symbolic links' search constraint. --group=group Select the 'Owned by group' search constraint and set the text of that entry. --hidden Select the 'Show hidden and backup files' search option. --mtimeless=date Select the 'Date modified before (days)' search constraint and set the text of that entry. --mtimemore=date Select the 'Date modified after (days)' search constraint and set the text of that entry. --named=text Set the text of the 'Name contains' search option. --notnamed=filename Select the 'File is not named' search constraint and set the text of that entry. Use a full filename or a partial filename with wildcards. See find(1) for more details about using wildcards. --nouser Select the 'Owner is unrecognized' search constraint. --path=folder Set the text of the 'Look in folder' entry. Defaults to the current working directory. --start Automatically start a search. --regex=pattern Select the 'File matches regular expression' search constraint and set the text of that entry. See find(1) for more details about the regular expression patterns that can be used. --sizeless=size Select the 'Size is less than (kilobytes)' search constraint and set the text of that entry. --sizemore=size Select the 'Size is more than (kilobytes)' search constraint and set the text of that entry. --sortby=order Sort files by one of the following: name, folder, size, type, or date. --user=user Select the 'Owned by user' search constraint and set the text of that entry. gnome-std-options Standard options available for use with most GNOME applications. See gnome-std-options(5) for more information. EXAMPLES
Example 1: Performing a basic search automatically example% gnome-search-tool --name=a.out --path=$HOME --autostart Example 2: Performing an advanced search automatically example% gnome-search-tool --contains=unistd.h --mtimeless=3 --sortby=size --autostart EXIT STATUS
The following exit values are returned: 0 Application exited successfully >0 Application exited with failure FILES
The following files are used by this application: /usr/bin/gnome-search-tool Executable for Search for Files ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-search-tool | +-----------------------------+-----------------------------+ |Interface stability |Volatile | +-----------------------------+-----------------------------+ SEE ALSO
Search for Files Manual Latest version of the GNOME Desktop User Guide for your platform. find(1), gnome-std-options(5) NOTES
Written by Glynn Foster, Sun Microsystems Inc., 2003, 2006. SunOS 5.11 2 Oct 2003 gnome-search-tool(1)
All times are GMT -4. The time now is 06:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy