The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to get the data from line number 1 to line number 100 of a file Anji Shell Programming and Scripting 9 11-03-2008 04:59 AM
Adding a columnfrom a specifit line number to a specific line number Ezy Shell Programming and Scripting 2 05-12-2008 09:29 AM
Appending line number to each line and getting total number of lines chiru_h Shell Programming and Scripting 2 03-25-2008 10:19 AM
Appending the line number and a seperator to each line of a file ? pjcwhite Shell Programming and Scripting 4 03-21-2007 01:29 AM
Unix Script with line number at beginning of each line. mascorro Shell Programming and Scripting 5 06-19-2006 05:34 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 3.00 average. Display Modes
  #1 (permalink)  
Old 10-29-2008
Satyak Satyak is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 85
Post getting the line number

hi
i have a file , that contains some data,i need to get the line numbr that cntains "Line timeout:" and thread no 3.
i am using lineno1=$(awk '/'$THREADNO' Line timeout:/ {print NR}' $FILE)

but the problem is if the thread no is 13, 23 , 43 it is taking that lines also,i need only that line that contains 3, Line timeout:

please help

thanks
Satya
  #2 (permalink)  
Old 10-29-2008
Franklin52 Franklin52 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,313
Post some lines of your input file and the desired output.

Regards
  #3 (permalink)  
Old 10-29-2008
Satyak Satyak is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 85
i/p file

20080729-115957.540859 [5521] D 3 Line timeout: 120
20080729-115957.540884 [5521] D 3 Start protocol: Wait SIGNON
20080729-115957.541100 [5521] D 3 Set timeout to: 120
-----------------------------------
-----------------------------
20080729-115957.540859 [5521] D 13 Line timeout: 120
20080729-115957.540884 [5521] D 13 Start protocol: Wait SIGNON
20080729-115957.541100 [5521] D 13 Set timeout to: 120

o/p
line number that contains only 3, Line timeout
  #4 (permalink)  
Old 10-29-2008
danmero danmero is offline Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,431
Should work now.
Code:
lineno1=$(awk '/ '$THREADNO' Line timeout:/ {print NR}' $FILE)
  #5 (permalink)  
Old 10-29-2008
paresh n doshi paresh n doshi is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 38
if your string is say xyz
you can give command
grep -n xyz filename
which will show the line with the line number
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:27 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0