Get last field specific record


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Get last field specific record
# 1  
Old 11-06-2012
Get last field specific record

i have file A as below contents

---------------------------
Code:
Use descriptive thread titles when posting.
For example, do not post questions with subjects like
"Help Me!", "Urgent!!" or "Doubt". 
For example, do not post questions
For example, do not deliminated.

output file as below:
question

explanation :need to display 4 line's last field

Last edited by Scrutinizer; 11-06-2012 at 03:43 PM.. Reason: code tags
# 2  
Old 11-06-2012
try:
Code:
awk 'NR==4 {print $NF}' infile

# 3  
Old 11-06-2012
thanks dude i will try and let u know shortly
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Prepend 0 to a field in a record

Hi All, I have a file like below. In the field 9 I am having 14,014,3,001/009 on the records. I want to convert the field to a three digit value. For example 14 should 014 , 3 should 003 11050;11001;;CREDITTRANC;5293218;NRATL;;;11095;;-1;14;3;29=0000;1.25... (5 Replies)
Discussion started by: arunkumar_mca
5 Replies

2. Shell Programming and Scripting

Display combination of 4 field uniqe record and along with concatenate 5th and 6th field.

Table ACN|NAME|CITY|CTY|NO1|NO2 115|AKKK|ASH|IND|10|15 115|AKKK|ASH|IND|20|20 115|AKKK|ASH|IND|30|35 115|AKKK|ASH|IND|30|35 112|ABC|FL|USA|15|15 112|ABC|FL|USA|25|20 112|ABC|FL|USA|25|45 i have written shell script using cut command and awk programming getting error correct it and add... (5 Replies)
Discussion started by: udhal
5 Replies

3. Shell Programming and Scripting

How to print with awk specific field different from specific character?

Hello, i need help with awk. I have this file: cat number DirB port 67 er_enc_out 0 er_bad_os 0 DirB port 71 er_enc_out 56 er_bad_os 0 DirB port 74 er_enc_out 0 er_bad_os 0 DirB port 75 ... (4 Replies)
Discussion started by: elilmal
4 Replies

4. Shell Programming and Scripting

Replace specific field on specific line sed or awk

I'm trying to update a text file via sed/awk, after a lot of searching I still can't find a code snippet that I can get to work. Brief overview: I have user input a line to a variable, I then find a specific value in this line 10th field in this case. After asking for new input and doing some... (14 Replies)
Discussion started by: crownedzero
14 Replies

5. Shell Programming and Scripting

Replace third field of the first record in a file....

Hi, I am new to unix and am trying to do something below: I have a pipe delimited file with millions of records. I need to replace the third column of the first record to the number of lines in the file. How can I do that. Will appreciate any advice and help. Thanks Simi (3 Replies)
Discussion started by: simi28
3 Replies

6. Shell Programming and Scripting

get a field from a record

I have a file as: A,B,C,D,E G,H,I,J,K I need to find if fourth field is blank or has a space and print that line to other file. I tried using awk but am not getting the desired result. Pls help. (6 Replies)
Discussion started by: praveenK_Dudala
6 Replies

7. Shell Programming and Scripting

how to replace field for each record

Hello, I have the following xml formatted file. I would like to get the newnumber field number and replace into customernumber for each record. For example: <XMLFORMAT> <customernumberR11>9</customernumberR11> ... (12 Replies)
Discussion started by: happyv
12 Replies

8. Shell Programming and Scripting

modify a few field of the record information

Hello, I have the following record in a text file, i would like modify some field: 1 - remove all space between ",", but the company name of word will not delete. Anyway, I can use the following statement to do it. 's/^ *//;s/ *, */,/g;s/ *$//' file 2. field #12, I need to modify to time... (11 Replies)
Discussion started by: happyv
11 Replies

9. UNIX for Dummies Questions & Answers

seaching field and getting complete record

hi, I have a file..... 1|3|4|5|6 1|3|4|4|5 now i ahave to search for value 4 in forth field and write that output to a file. if i do grep 4 file1 both lines are coming to output. can somebody help me building command. thanks and regards sandeep (4 Replies)
Discussion started by: mahabunta
4 Replies
Login or Register to Ask a Question