Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to find encapsulating function name from line number? Post 303032443 by kaaliakahn on Monday 18th of March 2019 11:19:41 AM
Old 03-18-2019
How to find encapsulating function name from line number?

I am looking at a log file which just tells me the filename and the line number inside that file that has the Error. What I am interested is knowing the encapsulating function. For example, here are the contents of the log file



Code:
   Error: foo.file on line wxy
        Error: foo.file on line xyz
        .
        .
        .

and here are the contents of the file foo.file





Code:
 function abc(...)
        .
        .
        .
        
        
        endfunction
        
        function def()
        .
        .
        .
       //Following line number is  WXY
        assign Z ==== X;
        
        endfunction
        
        
        function ghi(...)
        .
        .
        .
      
    
      //Following line number is  XYZ
        assign X = X;
        endfunction
    
       .
       .
       .

Based on the above log file, I want to get function names def and ghi returned. I have googled but can't find good pointers or starting points to solve this.
Moderator's Comments:
Mod Comment Please use CODE tags, not QUOTE tags, when displaying sample input, sample output, and code segments.

Last edited by Don Cragun; 03-18-2019 at 01:45 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Script to find the number of tab delimiters in a line

Hi, I need to find the number of tab delimiters in the first line of a file.So using word=`head -1 files.txt` I have extracted the first line of file into a variable word.It has 20 tab delimted columns.So can anyone help me in finding the number of delimiters? I am using csh and I am a... (5 Replies)
Discussion started by: poornimajayan
5 Replies

2. Shell Programming and Scripting

how to find the line number of a pattern of first appearance??

Hi, I am doin a project in shell script please answer the above question..... waiting........ (2 Replies)
Discussion started by: shivarajM
2 Replies

3. Shell Programming and Scripting

to find the number from a line.

Hi, I need to write a script which will have a text string as a input and the output should find out the number in the text string and add one to it. Eg: Input => asfdosainovih1234lnsiohn Output => 1235 All the numbers in the text will be together and only one time in the line. ... (2 Replies)
Discussion started by: vikings.svnit
2 Replies

4. Shell Programming and Scripting

find out line number of matching string using grep

Hi all, I want to display line number for matching string in a file. can anyone please help me. I used grep -n "ABC" file so it displays 6 ABC. But i only want to have line number,i don't want that it should prefix matching context with line number. Actually my original... (10 Replies)
Discussion started by: sarbjit
10 Replies

5. AIX

function trace back and address to line number conversion

Hi, I am new to AIX and I am developing a small tool for our product which helps debug memory leaks etc. Q1)Is there a way in which i can get a function trace back as to the call (lets say malloc() )has been made in which file--> in which function. I tried using the #pragma options (... (0 Replies)
Discussion started by: Wkdunreal
0 Replies

6. Shell Programming and Scripting

Take each number in table row and find the difference from the corresponding line

I have a two files containing numbers like below. First one contains one number on each line, the other is a table of numbers, each separated by a space. There are the same number of lines in each file. I want to take each number in the row of the table and find the difference from the... (12 Replies)
Discussion started by: kristinu
12 Replies

7. Shell Programming and Scripting

Find line number of bad data in large file

Hi Forum. I was trying to search the following scenario on the forum but was not able to. Let's say that I have a very large file that has some bad data in it (for ex: 0.0015 in the 12th column) and I would like to find the line number and remove that particular line. What's the easiest... (3 Replies)
Discussion started by: pchang
3 Replies

8. Shell Programming and Scripting

Find line number

How to find a line number? I have a file: 1 5 8 9 10 15 Is there a simple method to find out on which line for example the 9 is written? (3 Replies)
Discussion started by: jds93
3 Replies

9. Shell Programming and Scripting

How to find line number?

I have a data file (which has five columns) from which im finding column count of all the records and writing into separate file say "colcnt.txt". And I find one (or more) records have less column counts (i.e split records). I need to know which record(s) have that split scenario. Is there any way... (4 Replies)
Discussion started by: Prashanth B
4 Replies

10. Shell Programming and Scripting

awk to find number in a field then print the line and the number

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)
Discussion started by: Mudshark
5 Replies
DOVEADM-LOG(1)							      Dovecot							    DOVEADM-LOG(1)

NAME
doveadm-log - Locate, test or reopen Dovecot's log files SYNOPSIS
doveadm [-Dv] log errors doveadm [-Dv] log find [directory] doveadm [-Dv] log reopen doveadm [-Dv] log test DESCRIPTION
The doveadm log commands are used to locate and reopen the log files of dovecot(1). It's also possible to test the configured targets of the *log_path settings. OPTIONS
Global doveadm(1) options: -D Enables verbosity and debug messages. -v Enables verbosity, including progress counter. COMMANDS
log errors doveadm log errors The log errors command is used to show the last - up to 1,000 - errors and warnings. If no output is generated, no errors have occurred since the last start. log find doveadm log find [directory] The log find command is used to show the location of the log files, to which dovecot(1) sends its log messages. If dovecot(1) logs its messages through syslogd(8) and doveadm(1) could not find any log files, you can specify the directory where your syslogd writes its log files. log reopen doveadm log reopen This command causes doveadm to reopen all log files, configured in the log_path, info_log_path and debug_log_path settings. These settings are configured in /etc/dovecot/conf.d/10-logging.conf. This is for example useful after manually rotating the log files. log test doveadm log test This command causes doveadm to write the message "This is Dovecot's priority log (timestamp)" to the configured log files. The used prior- ities are: debug, info, warning, error and fatal. EXAMPLE
This example shows how to locate the log files used by dovecot(1). doveadm log find Looking for log files from /var/log Debug: /var/log/dovecot.debug Info: /var/log/mail.log Warning: /var/log/mail.log Error: /var/log/mail.log Fatal: /var/log/mail.log REPORTING BUGS
Report bugs, including doveconf -n output, to the Dovecot Mailing List <dovecot@dovecot.org>. Information about reporting bugs is avail- able at: http://dovecot.org/bugreport.html SEE ALSO
doveadm(1) Dovecot v2.1 2012-02-22 DOVEADM-LOG(1)
All times are GMT -4. The time now is 06:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy