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
compare files antointoronto Shell Programming and Scripting 8 06-24-2008 06:13 PM
compare files prashanth.spl Shell Programming and Scripting 0 06-18-2008 05:22 PM
Compare & replace contents within a file kaustubh137 Shell Programming and Scripting 2 05-27-2008 07:56 AM
compare files spt Shell Programming and Scripting 1 05-09-2008 11:57 AM
compare files ingunix UNIX for Dummies Questions & Answers 3 05-24-2001 12:44 PM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 06-24-2008
antointoronto antointoronto is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 28
compare 2 files and replace

Hi,

I have a file which contains names with counts for eg:

0622 0031 JOHN MAX 20080622003104. STAT 1.
0622 0031 BILL MAX 20080622003104. STAT 7.

and I have an exception file containing.

BILL

Can anyone help to write a script using this exception files to replace the STAT *(could be any number) to STAT 0 for the names that are in this list

the output should be and the format remains the same

0622 0031 JOHN MAX 20080622003104. STAT 0.

any comments or help appriciated.

I got a script which can do this, but it changes the format.
#!/usr/bin/ksh
nawk '
FNR==NR {ex[$1]; next}
{ $9 = ($1 in ex) ? "0." : $2; print }
' a2 a1 > a3

any help appriciated.
thanks

Last edited by antointoronto; 06-25-2008 at 01:32 AM..
 

Bookmarks

Tags
solaris

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 05:21 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