find string nth occurrence in file and print line number
Hi
I have requirement to find nth occurrence in a file and capture data from with in lines (between lines)
Data in File.
I want to get the first occurrence of the <SESSION> and </SESSION> and process between lines.
Again capture data from 2nd occurrence of the <SESSION> and </SESSION> until last occurrence repeat the same.
Hi,
I have several files with data that have to be imported to a database. These files contain records with separator characters. Some records are corrupt (2 separators are missing) and I need to correct them prior to importing them into the db.
Example:
... (5 Replies)
I'm trying find and print a number after a specific user passed string in each line of a text file using C (as requested by the powers that be). I've pieced together enough to read the file, find the string and print the line it was found on but I’m not sure where to even start in terms of finding... (3 Replies)
For example i'm having the below contents in a file:
expr is great when you want to split a string into just two parts. The .* also makes expr good for skipping a variable number of words when you don't know how many words a string will have. But expr is lousy for getting, say, the fourth word... (2 Replies)
Greetings experts. Searched the forums (perhaps not hard enough?) - Am searching for a method to capture all output from a log file following the nth occurrence of a known string.
Background:
Using bash, I want to monitor my Oracle DB alert log file. The script will count the total # of... (2 Replies)
if there's a file containing:
money king money queen money cat money also money king
all those strings are on one line in the file.
how can i find out how many times "money king" shows up in the line?
egrep -c "money king" wont work. (7 Replies)
Hello All,
I want to check if a delimiter is existing twice in a line of a text file.
Suppose flat file is like this
234 | 123
123 | 345
456 | 563 |
234 | 548
So the the 3rd line has two delimiters,
How can we find the lines in such a file having more then one delimiters
I tried... (5 Replies)
Bash/Oracle Linux 6.4
A basic requirement.
How can I get nth line of a file printed ? Can I use grep in this case ?
Example:
In the below file, 12th line is "Kernel parameter check passed for rmem_max" . I just want the 12 line to be printed.
# cat sometext.txt
Kernel version check... (2 Replies)
Hi,
I would like to know how, using sed, be able to insert contents of file2 in file1 after say the second occurrence of a given string? e.g.
> cat file1
banana
apple
orange
apple
banana
pear
tangerine
apple
> cat file2
I don't like apples
What would be the sed command to insert... (5 Replies)
Hi
I want to use awk to match where field 3 contains a number within string - then print the line and just the number as a new field.
The source file is pipe delimited and looks something like
1|net|ABC Letr1|1530|||
1|net|EXP_1040 ABC|1121|||
1|net|EXP_TG1224|1122|||
1|net|R_North|1123|||... (5 Replies)
My file (the output of an experiment) starts off looking like this,
_____________________________________________________________
Subjects incorporated to date: 001
Data file started on machine PKSHS260-05CP
**********************************************************************
Subject 1,... (9 Replies)
Discussion started by: samonl
9 Replies
LEARN ABOUT HPUX
dteditorfind
DtEditorFind(library call) DtEditorFind(library call)
NAME
DtEditorFind -- search for the next occurrence of a string in a DtEditor widget
SYNOPSIS
#include <Dt/Editor.h>
Boolean DtEditorFind(
Widget widget,
char *find);
DESCRIPTION
The DtEditorFind function searches for the next occurrence (relative to the insertion cursor) of a string. The string is either the last
find string value specified in the Find/Change dialog (see DtEditorInvokeFindChangeDialog(3)) or is passed in as an argument.
The widget argument specifies the DtEditor widget ID.
The find argument specifies the string to search for. If find is NULL, DtEditorFind uses the last string specified in the Find field of
the Find/Change dialog. 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.
For a complete definition of the DtEditor widget and its associated resources, see DtEditor(3).
RETURN VALUE
Upon successful completion, the DtEditorFind function returns True if the search string was found; otherwise, it returns False.
SEE ALSO
Dt/Editor.h - DtEditor(5), DtEditor(3), DtEditorChange(3), DtEditorInvokeFindChangeDialog(3).
DtEditorFind(library call)