Sponsored Content
Full Discussion: String search in log file
Top Forums Shell Programming and Scripting String search in log file Post 302782453 by Satyak on Tuesday 19th of March 2013 01:26:21 AM
Old 03-19-2013
Tools String search in log file

hi, i have a requirement to search for a sting "/user/data/<7digit>/<temp dir>/<file name>#<unique string> in a log file. This string present number of times but i need to get the first occurence only. i am trying with the below option but not working can you please help.
Code:
grep "/user/data/{'/[[:digit:]]{7}/[[:alnum:]]{1,255}'}#$<file name>#<unique string> trace.log >> /tmp/outputfile

thanks
satya

Last edited by Franklin52; 03-19-2013 at 04:19 AM.. Reason: Please use code tags for data and code samples
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

appending string to text file based on search string

Hi, I need to append string "Hi" to the beginning of the lines containing some specific string. How can I achieve that? Please help. Malay (1 Reply)
Discussion started by: malaymaru
1 Replies

2. Shell Programming and Scripting

String search in log file

Hi all! I have a log file from an incremental backup. This next script I've done works when the backup completes in the same day it started. But if the backup goes on to the next day, this one doesn't work anymore. ################################## #VARS data=`date '+%m/%d/%y'`... (1 Reply)
Discussion started by: sliver
1 Replies

3. Shell Programming and Scripting

search string in a file and retrieve 10 lines including string line

Hi Guys, I am trying to write a perl script to search a string "Name" in the file "FILE" and also want to create a new file and push the searched string Name line along with 10 lines following the same. can anyone of you please let me know how to go about it ? (8 Replies)
Discussion started by: sukrish
8 Replies

4. Shell Programming and Scripting

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

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 and add/replace... (1 Reply)
Discussion started by: suryanarayana
1 Replies

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

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

7. UNIX for Dummies Questions & Answers

Search for a specific String in a log file for a specific date range

Hi, I have log file which rolls out every second which is as this. HttpGenRequest - -<!--OXi dbPublish--> <created="2014-03-24 23:45:37" lastMsgId="" requestTime="0.0333"> <response request="getOutcomeDetails" code="114" message="Request found no matching data" debug="" provider="undefined"/>... (3 Replies)
Discussion started by: karthikprakash
3 Replies

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

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

10. UNIX for Beginners Questions & Answers

Search partial string in a file and replace the string - UNIX

I have the below string which i need to compare with a file and replace this string in the file which matches closely. Can anyone help me on this. string(Scenario 1)- user::r--,user::ourfrd:r-- String(Scenario 2)- user::r-- File **** # file: /local/Desktop/myfile # owner: me # group:... (6 Replies)
Discussion started by: sarathy_a35
6 Replies
voltrace(8)						      System Manager's Manual						       voltrace(8)

NAME
voltrace - Trace operations on volumes SYNOPSIS
/usr/sbin/voltrace [-eEla] [-d outputfile] [-f inputfile] [-t timeout] [-c eventcount] [-w waitinterval] [-b buffersize] [-g diskgroup] [-o objtype[,objtype]...] [name | device]... OPTIONS
The following options are recognized by voltrace: Selects new error trace data. The default is to select I/O trace data. Selects pre- existing error trace data. This can be combined with -e to get both preexisting trace data and new trace data. Specifies long format. Prints all available fields for all tracing records, rather than a subset of the available fields. The default is to use the short format. Writes (dumps) binary trace data to the specified output file. Appends to the outputfile rather than truncating it. By default, the out- put file is truncated. Reads binary trace data from the specified input file, rather than from the kernel. Accumulates trace data for at most timeout seconds and then exits. Accumulates at most eventcount events and then exits. The timeout and eventcount options can be used together. If voltrace waits for waitinterval seconds without receiving any new events, prints the message waiting... to allow scripts to wake up and process previously accumulated events. This is mostly of use for processing errors. The waiting... message does not count as an event for the purposes of the -c option. Sets the kernel I/O trace buffer size or sets the read buffer size when used with the -f option. The Logical Storage Manager kernel allocates a private kernel space to buffer the I/O trace records for each voltrace command. The default buffer size is 8K bytes. Some trace records may be discarded if the trace buffer is too small. This option can be used to set a larger or a smaller kernel trace buffer size. The buffer size is specified as a standard Logical Storage Manager length (see volintro(8)). Depending on the Logical Storage Manager kernel configuration, usually only a maximum of 64K bytes buffer size will be granted. Selects objects from the specified disk group. The disk group can be specified either by disk group ID or by disk group name. With no name or device operands, all appropriate objects in the disk group are selected. With name operands, diskgroup names the disk group that is expected to contain the named configuration record. Selects object based on the objtype option arguments. Multiple types of objects can be specified with one or several -o options. The possible object selection types are: Selects mirrored or RAID-5 volume kernel objects. Selects striped or concatenated plex kernel objects. Selects mirrored volume kernel objects. Selects subdisk kernel objects. Selects LSM physical disks. Selects virtual disk devices. Selects DRL or RAID-5 log volumes. Selects RAID-5 log plexes. Selects DRL or RAID-5 log subdisks. Selects all log objects. Selects all possible virtual disk devices, kernel objects and physical disks. If name or device operands are provided, kernel objects of the requested types are selected if they are associated with the configuration records or virtual disk devices indicated by those operands. DESCRIPTION
The voltrace utility prints kernel error or I/O trace event records on the standard output or writes them to a file in binary format. Binary trace records written to a file can be read back and formatted by voltrace as well. If no operands are given, either all error trace data or all I/O trace data on all virtual disk devices are reported. With error trace data, it is possible to select all accumulated error trace data, to wait for new error trace data, or both (the default). Selection can be limited to a specific disk group, to specific kernel I/O object types, or to particular named objects or devices. OPERANDS
Operands specify configuration record names, or physical or virtual disk device nodes (by device path). If no object types were selected with the -o option, only trace records corresponding to the indicated configuration records or devices are selected; otherwise, objects of the requested types are selected if they are associated in any way with the named configuration record or device. If a name argument does not match a regular configuration record but does match a disk access record, the indicated physical disk is selected. Physical disks can also be selected by the device path of the public region partition, or by the disk media record name. By default name arguments are searched for in all disk groups or in the disk group specified using the -g option. Without the -g option, a record that is found in more than one disk group will cause an error unless the record is in the rootdg disk group (in which case, the record in the rootdg disk group is selected). The disk group for any individual name operand can be overridden using the form: diskgroup/recordname Note When reading trace data from a file with the -f option, association information is not available. EXAMPLES
To trace all physical disk I/Os, use the command: # voltrace -o disk To trace virtual disk device I/Os to the device associated with volume testvol, use either of the commands: # voltrace -o dev testvol # voltrace /dev/vol/testvol To trace all log subdisks associated with volume testvol, use the command: # voltrace -o logsd testvol To trace all log objects, use the command: # voltrace -o log To accumulate 10 seconds worth of trace data for disk04 and then format that data, use the command: # voltrace -t 10 -d /tmp/tracedata disk04 # voltrace -l -f /tmp/tracedata To read error trace data into a script for processing, using 10 second pauses to generate mail messages, use the command: # voltrace -leE -w 10 | while read... FILES
Default device to which events are logged. SEE ALSO
volintro(8), volnotify(8), volstat(8) voltrace(8)
All times are GMT -4. The time now is 08:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy