Sponsored Content
Full Discussion: grep, awk, nawk combo
Top Forums Shell Programming and Scripting grep, awk, nawk combo Post 302357056 by scriptr2be on Monday 28th of September 2009 02:14:13 PM
Old 09-28-2009
Question grep, awk, nawk combo

I have 2 files:

File1
"aa","server","001-9031234-001",

File2
001-9031234-001|12345

Both files have many lines of text. Each line needs to be evaluated. I need to look at the value of the third field in File 1. Then look for that same value in File 2 and assign the value of Field 2 in that file to num.

so num for this example would equal 12345. The value of num would then be input back into File1 so File1 would then look like
"aa","server","001-9031234-001","12345",

Smilie
Thanks,
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

help with Awk or nawk

Can anyone explain to me why the first line doesn't work and the second seems to work fine. I am trying to find all occurances of text within a certain column (col 13) that start with the character V, I suppose it sounds simple but I have tried using the following but don't really understand what... (2 Replies)
Discussion started by: Gerry405
2 Replies

2. Shell Programming and Scripting

nawk -v to awk

hi, i have the command nawk -v i want to use it equivalent in awk? any help please :) (2 Replies)
Discussion started by: kamel.seg
2 Replies

3. UNIX for Dummies Questions & Answers

How to use awk instead of nawk?

Hi all, I can run the following script using nawk..However, I find that teh server dun support nawk.. May I know how to change teh script to use awk such that it will work? Very urgent.. thx! nawk 'BEGIN {FS=OFS=","} NR==FNR{arr=$2;next} $0 !~ "Documentation"{print $0;next} ... (2 Replies)
Discussion started by: kinmak
2 Replies

4. Shell Programming and Scripting

how to access values of awk/nawk variables outside the awk/nawk block?

i'm new to shell scripting and have a problem please help me in the script i have a nawk block which has a variable count nawk{ . . . count=count+1 print count } now i want to access the value of the count variable outside the awk block,like.. s=`expr count / m` (m is... (5 Replies)
Discussion started by: saniya
5 Replies

5. Shell Programming and Scripting

comparing awk and nawk

Hi Guys, i tried these two commands. First in awk and nawk. The nawk command is running fine but the awk command is throwing error. What is wrong with the awk command. There are lot of awk commands running fine in my system d003:/usr/local/dsadm/dsprod>nawk 'NR = 1 {print " "$0}' a.txt ... (6 Replies)
Discussion started by: mac4rfree
6 Replies

6. Shell Programming and Scripting

grep / nawk issue

I have a report which contains the following: Count Value % 47 69.12 18 26.47 3 4.41 I want to grep the total on the bottom brackets and store in a variable. However this may have a different figure everyday. To read the i do: ... (1 Reply)
Discussion started by: Pablo_beezo
1 Replies

7. UNIX for Dummies Questions & Answers

Help me to know about awk and nawk

Hi everyone, i am new to unix , so i want to know what is the use of awk and nawk. because in most of the place this cmds were used. so, if anyone provied the basic idea of this cmds, it will be much helpfull for me . . .. Thnks in Advance :) (9 Replies)
Discussion started by: natraj005
9 Replies

8. Shell Programming and Scripting

Awk,nawk Help please

Hi Guys, I am in need of some help; I have an xml message file which contains personal details as shown below: , message=, message=, message=, message=, message=, message= I want to use nawk to parse these xml messages but I am new to awk and nawk. What I want is to get output... (7 Replies)
Discussion started by: James_Owen
7 Replies

9. Shell Programming and Scripting

Use of -r, grep, nawk in script

Hello Friends, I am new to unix shell, need to understand the meaning of few cmds in below script, #!/usr/bin/ksh FTP_FILE_NAME="$1" if then grep "TRLR@@@@@@" $FTP_FILE_NAME | nawk -F"" '{print $2}' else echo "0" fi what is the use of -r, grep, nawk & -F in above script. Why... (2 Replies)
Discussion started by: DK2014
2 Replies
POE::Filter::IRCD(3pm)					User Contributed Perl Documentation				    POE::Filter::IRCD(3pm)

NAME
POE::Filter::IRCD - A POE-based parser for the IRC protocol. SYNOPSIS
use POE::Filter::IRCD; my $filter = POE::Filter::IRCD->new( debug => 1, colonify => 0 ); my $arrayref = $filter->get( [ $hashref ] ); my $arrayref2 = $filter->put( $arrayref ); use POE qw(Filter::Stackable Filter::Line Filter::IRCD); my ($filter) = POE::Filter::Stackable->new(); $filter->push( POE::Filter::Line->new( InputRegexp => '15?12', OutputLiteral => "1512" ), POE::Filter::IRCD->new(), ); DESCRIPTION
POE::Filter::IRCD provides a convenient way of parsing and creating IRC protocol lines. It provides the parsing engine for POE::Component::Server::IRC and POE::Component::IRC. A standalone version exists as Parse::IRC. CONSTRUCTOR
"new" Creates a new POE::Filter::IRCD object. Takes two optional arguments: 'debug', which will print all lines received to STDERR; 'colonify', set to 1 to force the filter to always colonify the last param passed in a put(), default is 0. See below for more detail. METHODS
"get_one_start" "get_one" "get_pending" "get" Takes an arrayref which is contains lines of IRC formatted input. Returns an arrayref of hashrefs which represents the lines. The hashref contains the following fields: prefix command params ( this is an arrayref ) raw_line For example, if the filter receives the following line, the following hashref is produced: LINE: ':moo.server.net 001 lamebot :Welcome to the IRC network lamebot' HASHREF: { prefix => ':moo.server.net', command => '001', params => [ 'lamebot', 'Welcome to the IRC network lamebot' ], raw_line => ':moo.server.net 001 lamebot :Welcome to the IRC network lamebot', } "put" Takes an arrayref containing hashrefs of IRC data and returns an arrayref containing IRC formatted lines. Optionally, one can specify 'colonify' to override the global colonification option. eg. $hashref = { command => 'PRIVMSG', prefix => 'FooBar!foobar@foobar.com', params => [ '#foobar', 'boo!' ], colonify => 1, # Override the global colonify option for this record only. }; $filter->put( [ $hashref ] ); "clone" Makes a copy of the filter, and clears the copy's buffer. "debug" With a true or false argument, enables or disables debug output respectively. Without an argument the behaviour is to toggle the debug status. MAINTAINER
Chris Williams <chris@bingosnet.co.uk> AUTHOR
Jonathan Steinert LICENSE
Copyright X Chris Williams and Jonathan Steinert This module may be used, modified, and distributed under the same terms as Perl itself. Please see the license that came with your Perl distribution for details. SEE ALSO
POE POE::Filter POE::Filter::Stackable POE::Component::Server::IRC POE::Component::IRC Parse::IRC perl v5.10.1 2009-12-11 POE::Filter::IRCD(3pm)
All times are GMT -4. The time now is 12:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy