Need help capturing end of line numbers


 
Thread Tools Search this Thread
Operating Systems Solaris Need help capturing end of line numbers
# 1  
Old 09-20-2007
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  
Old 09-20-2007
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  
Old 09-20-2007
I will try that now! thanks!
# 4  
Old 09-21-2007
Code:
# more file
word word=3
some more word=56
# awk -F"=" '{print $NF}' file
3
56

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Searching range of filenames witn and without numbers on the end

So I'm grepping for the following right now: ls -la /somedirectory/*.log* | awk '{print $9}' The problem with this is that I get the following output: /somedirectory/errors_1_foo.log /somedirectory/errors_1_foo.log.1 /somedirectory/errors_1_foo.log.2... (4 Replies)
Discussion started by: LinuxRacr
4 Replies

2. UNIX for Dummies Questions & Answers

Grep lines with numbers greater than 2 digits at the end of the line

I'm trying to grep lines where the digits at the end of each line are greater than digits. Tried this but it will only allow me to specify 2 digits. Any ideas would greatly be appreciated. grep -i '\<\{3,4,5\}\>' file ---------- Post updated at 05:58 PM ---------- Previous update was at 05:41... (1 Reply)
Discussion started by: jimmyf
1 Replies

3. Shell Programming and Scripting

Using awk to append incremental numbers to the end of duplicate file names.

I'm currently working on a script that extracts files from a .zip, runs an sha1sum against them and then uses awk to pre-format them into zomething more readable thusly: Z 69 89e013b0d8aa2f9a79fcec4f2d71c6a469222c07 File1 Z 69 6c3aea28ce22b495e68e022a1578204a9de908ed File2 Z 69... (5 Replies)
Discussion started by: Ethereal
5 Replies

4. Shell Programming and Scripting

Generate Codes based on start and End values of numbers in a column

Hello All, Could you please help with this. This is what I have: 506234.222 2 506234.222 2 506234.222 2 506234.222 2 508212.200 2 508212.200 2 333456.111 2 333456.111 2 333456.111 2 333456.111 2 But this is what I want: 506234.222 1 506234.222 2 506234.222 2 506234.222 3 (5 Replies)
Discussion started by: canimba
5 Replies

5. Shell Programming and Scripting

capturing the value in file before string(*) and the similar value in next line only

I've the output in the file like below. I want to capture the value in file before string(*) and the similar value in next line only. cat test1.txt 0003 Not Visible (M) 0 00 03F 0005 Not Visible (M) 0 00 040 - AVAILABLE 0 00... (1 Reply)
Discussion started by: sai_1712
1 Replies

6. Shell Programming and Scripting

Adding patterns with increasing numbers at the end of every line

Hi All, I have a file which has some Linux commands in every line like more 456.dat more 3232.dat more 433.dat I want to add texts like this at the end of every line: more 456.dat > 1.txt more 3232.dat > 2.txt more 433.dat > 3.txt So, that the result of more goes into 1.txt... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

7. Shell Programming and Scripting

Capturing multi-line records containing known value?

Some records in a file look like this, with any number of lines between start and end flags: /Start Some stuff Banana 1 Some more stuff End/ /Start Some stuff End/ /Start Some stuff Some more stuff Banana 2 End/ ...how would I process this file to find records containing the... (8 Replies)
Discussion started by: cs03dmj
8 Replies

8. Shell Programming and Scripting

Capturing a number at the end of line and store it as variable

Hello, Would someone guide me on how to write a shell script the would search for a phone no using at the end text file using sed or awk and store it in a varaible or print it. The text file is in this form text or numbers in first line text or numbers in second line . . . Firsname... (6 Replies)
Discussion started by: amuthiga
6 Replies

9. UNIX for Advanced & Expert Users

Add line numbers to end of each line

Hi i would like to add line numbers to end of each line in a file. I am able to do it in the front of each line using sed, but not able to add at the end of the file. Can anyone suggest The following code adds line number to start of each line sed = filename | sed 'N;s/\n/\t/' how can i... (5 Replies)
Discussion started by: rudoraj
5 Replies

10. Shell Programming and Scripting

Need to total numbers at end of script

I need to total the numbers at the end of script, what code can i use for this to total the lines up? 1232 1242 1234 Total count is 3708 (9 Replies)
Discussion started by: wereyou
9 Replies
Login or Register to Ask a Question