Sponsored Content
Full Discussion: Find string in text file
Top Forums Shell Programming and Scripting Find string in text file Post 302514492 by optik77 on Saturday 16th of April 2011 02:30:50 AM
Old 04-16-2011
OK! Thnx!
But can I use such structure:

PHP Code:
if (check_exists_of('test-string-first','filename.txt'then
 MYVAR 
awk .... filename.txt
 
echo $MYVAR
else
 echo 
'file doesn't contain '''test-string-first@'' string!'
 
fi 
?
help me pls to change check_exists_of('test-string-first','filename.txt') and MYVAR = awk .... filename.txt statements to the correct.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Looking for command(s)/ script to find a text string within a file

I need to search through all files with different file suffixes in a directory structure to locate any files containing a specific string (5 Replies)
Discussion started by: wrwelden
5 Replies

2. Shell Programming and Scripting

find a string in a file and add some text after that file

Hi Could you please help me out by solving teh below problem ? I have a file with as below source1|target1|yes source2|target2|no source1 is file in which i have to place some code under the <head> tag in it. What code i have to place in source1 is something like this "abcd.....<target1>... (5 Replies)
Discussion started by: Tasha_T
5 Replies

3. Shell Programming and Scripting

Find a special string in a text document

Hi, i got stuck in creating a search job. I have a text file which looks like this: ====================== Backup - OK - Backup - OK - Backup - ERROR - Backup - WARNING - ====================== I want to search the text file for the string ERROR. If this string is present in the... (10 Replies)
Discussion started by: lnino
10 Replies

4. Shell Programming and Scripting

find string(s) in text file and nearby data, export to list help

Hi, So I'm kinda new to shell scripts and the like. I've picked up quite a bit of use from browsing the forums here but ran into a new one that I can't seem to find an answer for. I'm looking to parse/find a string AND the next 15 or so charachters that follow the string within a text file... (1 Reply)
Discussion started by: kar23me
1 Replies

5. Shell Programming and Scripting

How to find repeated string in a text file

I have a text file where I need to find the string = ST*850* This string is repetaed several times in the file, so I need to know how many times it appears in the file, this is the text files: ISA*00* *00* *08*925485USNR *ZZ*IMSALADDERSP... (13 Replies)
Discussion started by: cucosss
13 Replies

6. Shell Programming and Scripting

Search a string in a text file and add another string at the end of line

Dear All I am having a text file which is having more than 200 lines. EX: 001010122 12000 BIB 12000 11200 1200003 001010122 2000 AND 12000 11200 1200003 001010122 12000 KVB 12000 11200 1200003 In the above file i want to search for string KVB... (5 Replies)
Discussion started by: suryanarayana
5 Replies

7. Shell Programming and Scripting

[Need help] perl script to find the occurance of string from a text file

I have two files 1. input.txt 2. keyword.txt input.txt has contents like .src_ref 0 "call.s" 24 first 0x000000 0x5a80 0x0060 BRA.l 0x60 .src_ref 0 "call.s" 30 first 0x000002 0x1bc5 RETI .src_ref 0 "call.s" 31 first 0x000003 0x6840 ... (2 Replies)
Discussion started by: acdc
2 Replies

8. Shell Programming and Scripting

Find string in file and find the all records by string

Hello I would like to get know how to do this: I got a big file (about 1GB) and I need to find a string (for instance by grep ) and then find all records in this file based on a string. Thanks for advice. Martin (12 Replies)
Discussion started by: mape
12 Replies

9. UNIX for Beginners Questions & Answers

Find and replace a string in a text file

Dear all, I want to find all the "," in my text file and then replace the commas to a tab. I found a script online but I don't know how to modify the script for my case. Any one can help? Thank you. @echo off &setlocal set "search=%1" set "replace=%2" set "textfile=Input.txt" set... (2 Replies)
Discussion started by: forevertl
2 Replies

10. 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
DtEditorChange(library call)											      DtEditorChange(library call)

NAME
DtEditorChange -- change one or all occurrences of a string in a DtEditor widget SYNOPSIS
#include <Dt/Editor.h> Boolean DtEditorChange( Widget widget, DtEditorChangeValues *findChangeStrings, unsigned int instanceToChange); DESCRIPTION
The DtEditorChange function replaces the next occurrence of a string, all occurrences of the string, or the currently selected text in a DtEditor widget with a replacement string. The string to search for and the value to change it to can be the last values entered in the Find/Change dialog (see DtEditorInvokeFindChangeDialog(3)) or passed as arguments to DtEditorChange. The search begins at the insertion cursor. If the string is not found by the time the end of the document is reached, the search continues at the beginning of the document, stopping at the character before the insertion cursor. The widget argument specifies the DtEditor widget ID. The findChangeStrings argument specifies the string to change and the replacement value. If findChangeStrings is NULL, DtEditorChange uses the last string specified in the Find and Change To fields of the Find/Change dialog. If the instanceToChange argument is DtEDITOR_CUR- RENT_SELECTION, the Find field of DtEditorChangeValues is ignored. If the instanceToChange argument is set to DtEDITOR_NEXT_OCCURRENCE, DtEditorChange replaces the next occurrence (relative to the insertion cursor) of the find string. If this argument is set to DtEDITOR_ALL_OCCURRENCES, all instances of the find string are changed. If this argument ia set to DtEDITOR_CURRENT_SELECTION, the Find field of DtEditorChangeValues, is ignored and the currently selected text is replaced. For a complete definition of the DtEditor widget and its associated resources, see DtEditor(3). For a complete definition of DtEditorChangeValues, see Dt/Editor.h - DtEditor(5). RETURN VALUE
Upon successful completion, the DtEditorChange function returns True if the substitution occurred; otherwise, it returns False. SEE ALSO
Dt/Editor.h - DtEditor(5), DtEditor(3), DtEditorFind(3), DtEditorInvokeFindChangeDialog(3). DtEditorChange(library call)
All times are GMT -4. The time now is 02:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy