The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Operating Systems > SUN Solaris
.
google unix.com



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
generating line numbers sam4now Shell Programming and Scripting 7 04-28-2008 07:17 PM
capturing line from script output and appending to a file wally_welder Shell Programming and Scripting 6 08-31-2007 04:03 AM
add line numbers esham Shell Programming and Scripting 4 03-07-2005 10:46 AM
Printing line numbers MizzGail UNIX for Dummies Questions & Answers 2 07-25-2002 05:18 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 Rate Thread Display Modes
  #1 (permalink)  
Old 09-20-2007
icalderus icalderus is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 3
Need help capturing end of line numbers

Hello All,

Currently I am attempting to write a script which will capture a number at the end of a line.

The line which I am searching through ends as follows:


word word=number

for example

word word=3

OR

word word=15

I am stuck on how to capture whatever is to the right of the "=" to the end of the line. The number will vary from a single to a double digit number.

Ideally I would like to use this number for further actions downstream.

However currently I am unable to capture this number to the right of the "=" character.


Can someone please input on this? THANKS!!!
  #2 (permalink)  
Old 09-20-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,805

Code:
while read record
do
     echo "$record" | awk -F'='    '{print $2}' | read last_number
done < filename


Last edited by vgersh99; 09-20-2007 at 07:20 PM.. Reason: missing tags
  #3 (permalink)  
Old 09-20-2007
icalderus icalderus is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 3
I will try that now! thanks!
  #4 (permalink)  
Old 09-21-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,557

Code:
# more file
word word=3
some more word=56
# awk -F"=" '{print $NF}' file
3
56

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 09:38 PM.


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