Sponsored Content
Top Forums Shell Programming and Scripting Find a special string in a text document Post 302403349 by murugaperumal on Friday 12th of March 2010 07:17:13 AM
Old 03-12-2010
You can use the following code

Code:
while read line
do

`echo $line | grep "ERROR" >/dev/null`
if [  $? -eq  0 ];
then
        echo "Matched ERROR the line is $line"
fi
done < file

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help on find a document

Hey all, I've been trying to find a document. The document is a list of all supported hardware that Solaris 7 supports. If anyone knows where this can be found thx in advanced. I've tried looking through the docs.sun.com site and can't find what I am after. It's just a list of hardware... (1 Reply)
Discussion started by: merlin
1 Replies

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

3. UNIX for Dummies Questions & Answers

Help with find and replace w/string containing special characters

Can I get some help on this please, I have looked at the many post with similar questions and have tried the solutions and they are not working for my scenario which is: I have a text file (myfile) that contains b_log=$g_log/FILENAME.log echo "Begin processing file FILENAME " >> $b_log ... (4 Replies)
Discussion started by: CAGIRL
4 Replies

4. Shell Programming and Scripting

Find text containing paths and replace with a string in all the python files

I have 100+ python files in a single directory. I need to replace a specific path occurrence with a variable name. Following are the find and the replace strings: Findstring--"projects\\Debugger\\debugger_dp8051_01\\debugger_dp8051_01.cywrk" Replacestring--self.projpath I tried... (5 Replies)
Discussion started by: noorsam
5 Replies

5. UNIX for Dummies Questions & Answers

find text enclosed between special characters

Hi, I'm trying to find all DISTINCT words having _mr in the line and ENCLOSED in '/'. For eg below is the text in a file.. /database/new_mr254/1 /database/rawdb/views/new_mr254/1 /database/project/rawdb/tables/new_mr232/1 /database/project/rawdb/views/new_mr253/1... (5 Replies)
Discussion started by: northwest
5 Replies

6. Shell Programming and Scripting

Find string in text file

Hello! Please, help me to write such script. I have some text file with name filename.txt I must check if this file contains string "test-string-first", I must cut from this file string which follows string "keyword-string:" and till first white-space and save it to some variable. For... (3 Replies)
Discussion started by: optik77
3 Replies

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

8. Shell Programming and Scripting

sed - Find a String and append a text end of the Line

Hi, I have a File, which have multiple rows. Like below 123456 Test1 FNAME JRW#$% PB MO Approver XXXXXX. YYYY 123457 Test2 FNAME JRW#$% PB MO Super XXXXXX. YYYY 123458 Test3 FNAME JRW#$% PB MO Approver XXXXXX. YYYY I want to search a line which contains PB MO Approver and append... (2 Replies)
Discussion started by: java2006
2 Replies

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

10. 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
DXmCreateScrolledCSText(3X)											       DXmCreateScrolledCSText(3X)

NAME
DXmCreateScrolledCSText - Creates a compound string text widget with scroll bars. SYNOPSIS
Widget DXmCreateScrolledCSText( Widget parent, char *name, Args *args, Cardinal num_args ); PARAMETERS
The identifier (widget ID) of the parent widget. The name of the created widget. The application override argument list. The number of arguments in the application override argument list. DESCRIPTION
The DXmCreateScrolledCSText routine creates a compound string text widget with scroll bars. The routine uses the same arguments and resources as the DXmCreateCSText routine to create a compound string text widget but uses the following resources to create horizontal and vertical scroll bars for the widget as well: ------------------------------------------------------------------- Resource Description ------------------------------------------------------------------- XmNscrollHorizontal Controls whether a scroll bar that allows the user to scroll through text horizontally is added to the compound string text window. XmNscrollTopSide Controls whether the horizontal scroll bar is positioned at the top of the compound string text window. XmNscrollVertical Controls whether a scroll bar that allows the user to scroll through text vertically is added to the compound string text window. XmNscrollLeftSide Controls whether the vertical scroll bar is placed on the left side of the compound string text window. ------------------------------------------------------------------- Inherited Resources The DXmCreateScrolledCSText routine inherits behaviour and resources from the following superclasses: Core Resource Set XmPrimitive Resource Set DXmScrolledCSText Resource Set RETURN VALUES
The identifier (widget ID) of the created compound string text widget. SEE ALSO
DXmCreateCSText(3X) DXmCreateScrolledCSText(3X)
All times are GMT -4. The time now is 11:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy