Sponsored Content
Top Forums Shell Programming and Scripting Print required values at end of the file by using AWK Post 302515723 by dvrbabu on Wednesday 20th of April 2011 06:15:36 PM
Old 04-20-2011
thanks for update. when i ran same command I am getting same values for other records like bleow.

Code:
sed 's/$/634691922 634691938 20110417/' input.txt

Code:
Detail Id    Info Id    Order Id         STATUS    Status Date               File Detail                                                                                                                          634691922 634691938 20110417
98850008     816148     CMOG221598756    PR        04-02-2011 06:00:24PM     60_R010|BDLPRICE|596695619|DATA|Y|N|596695629|20110402|C|846101152-1|26108|Y5893|H7239-1||||||||||||||||||||||||||||||               634691922 634691938 20110417
98850009     816148     CMOG221598771    PR        04-02-2011 06:00:26PM     60_R010|BDLPRICE|480566958|DATA|Y|Y|480566977|20110402|C|480566963-1|32010|G8607|H7187-1||||||||||||||||||||||||||||||               634691922 634691938 20110417 (these values should replace with above bold Green color values)
98850010     816148     CMOG221598780    PR        04-02-2011 06:00:28PM     60_R010|BDLPRICE|610843968|DATA|Y|N|610843981|20110402|C|610843972-1|25930|Y4820|H7438-1||||||||||||||||||||||||||||||               634691922 634691938 20110417 (these values should replace with above bold RED color values)



This will work same value for all records. but I want to check reach record in input file and print the values at end. above two records in green and red color are output examaples.

Thanks
Moderator's Comments:
Mod Comment
Please use code tags when posting data and code samples!


---------- Post updated at 05:15 PM ---------- Previous update was at 05:01 PM ----------

I am looking the output file as below.

Code:
Detail Id    Info Id    Order Id         STATUS    Status Date               File Detail                                                                                                                          
98850008     816148     CMOG221598756    PR        04-02-2011 06:00:24PM     60_R010|BDLPRICE|596695619|DATA|Y|N|596695629|20110402|C|846101152-1|26108|Y5893|H7239-1||||||||||||||||||||||||||||||               596695619 596695629 20110402
98850009     816148     CMOG221598771    PR        04-02-2011 06:00:26PM     60_R010|BDLPRICE|480566958|DATA|Y|Y|480566977|20110402|C|480566963-1|32010|G8607|H7187-1||||||||||||||||||||||||||||||               480566958 480566977 20110402
98850010     816148     CMOG221598780    PR        04-02-2011 06:00:28PM     60_R010|BDLPRICE|610843968|DATA|Y|N|610843981|20110402|C|610843972-1|25930|Y4820|H7438-1||||||||||||||||||||||||||||||               610843968 610843981|20110402


Last three values I have picked from filedetail values which is delmited by pipe.(Third,7th and 8th value)

thanks

Last edited by Franklin52; 04-21-2011 at 03:09 AM.. Reason: code tags, please!
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Urgent Help required : awk/sed help to find pattern and delete till end of line

Hi, I need help with using an awk or sed filter on the below line ALTER TABLE "ACCOUNT" ADD CONSTRAINT "ACCOUNT_PK" PRIMARY KEY ("ACCT_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "WMC_DATA" LOGGING ENABLE Look for... (1 Reply)
Discussion started by: rajan_san
1 Replies

2. UNIX and Linux Applications

Print date at END clause of AWK

Hi to all! I 'm new in unix programing so... may be I decided a wrong tool to solve the problem but anyway... all road goes to rome jajaja. My question is: There is any way to print date at the END clause of an AWK script. I mean, I'm writing a tool with AWK and the results are redirected to a... (4 Replies)
Discussion started by: fmeriles
4 Replies

3. Shell Programming and Scripting

How to Print from matching word to end using awk

Team, Could some one help me in Printing from matching word to end using awk For ex: Input: I am tester for now I am tester yesterday I am tester tomorrow O/p tester for now tester yesterday tester tomorrow i.e Starting from tester till end of sentence (5 Replies)
Discussion started by: mallak
5 Replies

4. UNIX for Advanced & Expert Users

Awk to print values of second file

Hello, I have a data file with 300,000 records in it, and another file which contains only the line numbers of roughly 13,000 records in the data file which have data integrity issues. I'm trying to find a way to print the original data by line number identified in the second file. How can I do... (2 Replies)
Discussion started by: peteroc
2 Replies

5. Shell Programming and Scripting

awk, sed or perl regexp to print values from file

Hello all According to the following file (orignal one contains 200x times the same structure...) I was wondering if someone could help me to print <byte>??</byte> values example, running this script/command like ./script.sh xxapp I would expect as output: 102 116 112 ./script.sh xxapp2... (2 Replies)
Discussion started by: cabrao
2 Replies

6. Shell Programming and Scripting

Compare values in two files. For matching rows print corresponding values from File 1 in File2.

- I have two files (File 1 and File 2) and the contents of the files are mentioned below. - I am trying to compare the values of Column1 of File1 with Column1 of File2. If a match is found, print the corresponding value from Column2 of File1 in Column5 of File2. - I tried to modify and use... (10 Replies)
Discussion started by: Santoshbn
10 Replies

7. Shell Programming and Scripting

Required help to print diff columns for 2 patterns using awk

Hi All, I need help for below scenario : I have a principals.xml_24092012backup file : cat principals.xml_24092012backup </user> <user username="eramire" password="2D393C01720749256303D204826A374D9AE9ABABBF8A"> <roleMapping rolename="VIEW_EVERYTHING"/> </user> ... (2 Replies)
Discussion started by: kiran_j
2 Replies

8. Shell Programming and Scripting

awk one liner to print to end of line

Given: 1,2,whatever,a,940,sot how can i print from one particular field to the end of line? awk -F"," '{print $2 - endofline}' the delimiter just happens to be a comma "," in this case. in other cases, it could be hypens: 1---2---whatever---a---940---sot (4 Replies)
Discussion started by: SkySmart
4 Replies

9. Shell Programming and Scripting

awk to print line is values between two fields in separate file

I am trying to use awk to find all the $3 values in file2 that are between $2 and $3 in file1. If a value in $3 of file2 is between the file1 fields then it is printed along with the $6 value in file1. Both file1 and file2 are tab-delimited as well as the desired output. If there is nothing to... (4 Replies)
Discussion started by: cmccabe
4 Replies

10. Shell Programming and Scripting

Perl to extract values and print at end of each line

In the below perl I am trying to extract and print the values AF1=, the GT value, and F or QUAL diveded by 33 (rounded to the nearest whole #). The GT value is at the end after the GT:PL so all the possibilities are read into a hash h, then depending on the value that is in the line the... (1 Reply)
Discussion started by: cmccabe
1 Replies
All times are GMT -4. The time now is 09:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy