Get line numbers while searching the pattern in log


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Get line numbers while searching the pattern in log
# 1  
Old 06-12-2012
Error Get line numbers while searching the pattern in log

Hi Folks,
I am searching for a pattern in logs through putty by opening the file in vi editor
and reaching to the last of the file by
Code:
$

and then searching the pattern , lets say I have to search the pattern abc then it would be
Code:
?abc

Now I want line numbers along with the matching pattern to be get in vi itself then what would be the command to get line numbers along..!Please advise
# 2  
Old 06-12-2012
Take a look at this posting, as it talks about various settings in vi.
https://www.unix.com/unix-dummies-que...vi-editor.html
# 3  
Old 06-16-2012
Hi folks,
Please advise for the command.
# 4  
Old 06-16-2012
Code:
:set number

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed pattern fails to delete line of numbers

We are using Red Hat Linux. I have a flat file with among other things, the following lines, which appear occasionally throughout the file: Using sed, I delete this line: L;L;L;L;R;R;R;L;R;L;R;R;R;L;L;L With: /^;;;;;*/d Works fine every time. However, I cannot delete... (6 Replies)
Discussion started by: bloomlock
6 Replies

2. Shell Programming and Scripting

Searching for a pattern and extracting records related to that pattern

Hi there, Looking forward to your advice for the below: I have a file which contains 2 paragraphs related to a particular pattern. I have to search for those paragraphs from a log file and then print a particular line from those paragraphs. Sample: I have one file with the fixed... (3 Replies)
Discussion started by: danish0909
3 Replies

3. Shell Programming and Scripting

Grep the word from pattern line and update in subsequent lines till next pattern line reached

Hi, I have got the below requirement. please suggest. I have a file like, Processing Item is: /data/ing/cfg2/abc.txt /data/ing/cfg3/bgc.txt Processing Item is: /data/cmd/for2/ght.txt /data/kernal/config.klgt.txt I want to process the above file to get the output file like, ... (5 Replies)
Discussion started by: rbalaj16
5 Replies

4. Shell Programming and Scripting

How to display the line number of file while searching for a pattern

awk 'BEGIN{IGNORECASE=1} /error|warning|exception/ { ++x } END { print x }' filename The above command returning the number of times the pattern present in the file. But I want the the line number as well. please help me out (6 Replies)
Discussion started by: arukuku
6 Replies

5. Shell Programming and Scripting

Place digit in front of the line searching pattern using sed command

hi All, i want to add the single digit front of the line in the report file and string compare with pattern file. patter file: pattern1.txt pattern num like 4 love 3 john 2 report file: report.txt i like very much but john is good boy i will love u so after execute... (9 Replies)
Discussion started by: krbala1985
9 Replies

6. Shell Programming and Scripting

grep a pattern with line numbers.

I have a txt file with more than 10000 lines. There is a unique pattern which is scattered into the file. it starts with @9 and it has 15 characters. i need to grep them and display along with line numbers. Eg: File - Test1 test message.... .... .. .. @9qwerty89 ...test message... (8 Replies)
Discussion started by: abinash
8 Replies

7. Shell Programming and Scripting

Searching a pattern in file and deleting th ewhole line containing the pattern

Hi All, Please can someone assist in the script I have made that searches a pattern in a file and delete the whole line containing the pattern. #!bin/sh # The pattern that user want to add to the files echo "Enter the pattern of the redirect" read value # check if the user has... (1 Reply)
Discussion started by: Shazin
1 Replies

8. Shell Programming and Scripting

searching for decimal numbers in a file

hi all, was wanting to know how to search for decimal numbers in a file ? am using solaris 8 and have tried a few options with "grep" but none of them seem to work. thanks in advance. (1 Reply)
Discussion started by: cesarNZ
1 Replies

9. Shell Programming and Scripting

Pattern searching pattern in c files

I have a problem in searching a specific pattern in c files. My requirement: I have to find all the division operator in all cfiles. The problem is, the multi line comments and single line comments will also have forward slash in it. Even after avoiding these comments also, if both... (6 Replies)
Discussion started by: murthybptl
6 Replies

10. Shell Programming and Scripting

Searching for data on a specific line numbers

Hi, I have a file on windows and have some unix utilitties available on windows. This file is very large and have over 5 million record. I am not able to open this file in Window Editor. I am trying to see bad data on a specific lines. I just have line numbers that has bad data. I need to see the... (8 Replies)
Discussion started by: rkumar28
8 Replies
Login or Register to Ask a Question