Sponsored Content
Top Forums Shell Programming and Scripting Problem with the awk in searching the contents in a file Post 302618421 by Scrutinizer on Wednesday 4th of April 2012 02:44:09 AM
Old 04-04-2012
Hi, you were on your way, but you need to distinguish the phases in which you are processing filea or fileb. When NR is equal to FNR, awk is processing the first file which in this case is fileb. There is no input processing in the END section.
Code:
awk 'NR==FNR{A[$3]=$1;next}{for(i in A)if(i~$1"\;" && i~$2"\;") print A[i],$0 }' fileb filea

Code:
バーストリミット sm982882  sm1893548


Last edited by Scrutinizer; 04-04-2012 at 03:50 AM..
This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Searching contents of a file

Is there a way a command or a combination through which i can check the contents of a all files in a directory and get the return as the file names which contains the partiuclar string. (2 Replies)
Discussion started by: thepitzaboy
2 Replies

2. Shell Programming and Scripting

searching and editing file contents

Can you please help me to edit parts of a file and write into a new file. ===================================== Suppose I have a huge data dump in a file I need to search for a tag in that and cut few lines around that tag in the file. Is there a way to keep track of line numbers and operate on... (18 Replies)
Discussion started by: jayana
18 Replies

3. Shell Programming and Scripting

PERL: Searching for a string in a text file problem

Looking for a bit of help. I need to search for a string of words, but unfortunately these words are located on separate lines. for example the text output is: United Chanmpions Ronaldo Liverpool Losers Torres and my script code is print("DEBUG - checking file message"); while... (15 Replies)
Discussion started by: meevagh
15 Replies

4. Shell Programming and Scripting

problem while searching in a file by 'AWK'

Hi , i am writing a script in which i am using following command to grep some string and then storing it's output to v, as like below :- v=$(awk -F, '{ if ( $NF ~ /DEV/ ) print $0 "_BLD01";else print $0 "_RC01" }' mytest) Here i am facing following issues:- 1. it is searcing DEV in the... (1 Reply)
Discussion started by: inderpunj
1 Replies

5. Shell Programming and Scripting

Searching a file using awk or sed

I want to search a file in a specific location and I don't want to use find command. I want to give the path also where the file is for searching it. Pls help (3 Replies)
Discussion started by: maitree
3 Replies

6. UNIX for Dummies Questions & Answers

Help with searching for a file in a directory and copying the contents of that file in a new file

Hi guys, I am a newbie here :wall: I need a script that can search for a file in a directory and copy the contents of that file in a new file. Please help me. :confused: Thanks in advance~ (6 Replies)
Discussion started by: zel2zel
6 Replies

7. Shell Programming and Scripting

Problem with searching and then editing a file through shell.

Hi, I have searched through this forum as there are many similar entries but could'nt get one of them to work, either that or they were just different to what I needed. Basically I have a file, recordsDatabase. In this file are a few different fields. There is a unique identifier eg 001... (5 Replies)
Discussion started by: U_C_Dispatj
5 Replies

8. Shell Programming and Scripting

Help in searching a particular string in a file name (not inside the file contents)

Dear Unix Gurus, I am new to shell scripting and in the process of learing. I am trying to find whether a file name has today's date in MMDDYYYY format. I am using the following code and it doesn't seem like working. #!/usr/bin/ksh today=$(date '+%m%d%Y') echo today: $today file=`find... (4 Replies)
Discussion started by: shankar1dada
4 Replies

9. Shell Programming and Scripting

Searching the pattern and accordingly changing the contents using shell

HI, I have File1 which contains :- admins = anand,satheesha,user1,user2,user3,user4,user5,user10,vishal nonadmins = read-only @admins = rw @nonadmins = r One shell script, using that I want to change the File1 as per user input (let's say $1) which have value as 'John', so now I want to... (6 Replies)
Discussion started by: Vishal Mishra
6 Replies

10. UNIX for Dummies Questions & Answers

Problem to grep contents from a file

hi, I'm trying to grep content from one file in another file. The file that I'm searching into is large and hence I need to temporarily unzip it first. gzip -dc ALL.chr2.phase3_shapeit2_mvncall_integrated_v5a.20130502.genotypes.vcf.gz | grep '169997024\|190670539\|128051369' >... (2 Replies)
Discussion started by: janshamsani
2 Replies
AUTODIA(1p)						User Contributed Perl Documentation					       AUTODIA(1p)

NAME
autodia - a perl script using the Autodia modules to create UML Class Diagrams or documents. from code or other data sources. INTRODUCTION
AutoDia takes source files as input and using a handler parses them to create documentation through templates. The handlers allow AutoDia to parse any language by providing a handler and registering in in autodia.pm. The templates allow the output to be heavily customised from Dia XML to simple HTML and seperates the logic of the application from the presentation of the results. AutoDia is written in perl and defaults to the perl handler and file extension matching unless a language is specified using the -l switch. AutoDia requires Template Toolkit and Perl 5. Some handlers and templates may require additional software, for example the Java SDK for the java handler. AutoDia can use GraphViz to generate layout coordinates, and can produce di-graphs (notation for directional graphs) in dot (plain or canonical) and vcg, as well as Dia xml. Helpful information, links and news can be found at the autodia website - http://www.aarontrevena.co.uk/opensource/autodia/ USAGE
"autodia ([-i filename [-p path] ] or [-d directory [-r] ]) [options]" "autodia -i filename : use filename as input" "autodia -i 'filea fileb filec' : use filea, fileb and filec as input" "autodia -i filename -p .. : use ../filename as input file" "autodia -d directoryname : use *.pl/pm in directoryname as input files" "autodia -d 'foo bar quz' : use *pl/pm in directories foo, bar and quz as input files" "autodia -d directory -r : use *pl/pm in directory and its subdirectories as input files" "autodia -d directory -F : use files in directory but only one file per diagram" =item "autodia.pl -d directory -C : use files in directory but skip CVS directories" "autodia -o outfile.xml : use outfile.xml as output file (otherwise uses autodial.out.dia)" "autodia -O : output to stdout" "autodia -l language : parse source as language (ie: C) and look for appropriate filename extensions if also -d" "autodia -t templatefile : use templatefile as template (otherwise uses template.xml)" "autodia -l DBI -i "mysql:test:localhost" -U username -P password : use test database on localhost with username and password as username and password" "autodia -l Mason -i "/index.html" -p comp_root -G '$c' : use HTML::Mason to fetch /index.html from comp_root and show all components in reach. -G corresponds to allow_globals." "autodia -z : output via graphviz" "autodia -Z : output via springgraph" "autodia -v : output via VCG " "autodia -s skipfile : exclude files or packagenames matching those listed in file" c<autodia -D : ignore dependancies (ie do not process or display dependancies)> "autodia -K : do not display packages that are not part of input" "autodia -k : do not display superclasses that are not part of input" "autodia -H : show only Public/Visible methods" "autodia -m : show only Class methods" "autodia -M : do not show Class Methods" "autodia -a : show only Class Attributes" "autodia -A : do not show Class Attributes" "autodia -S : silent mode, no output to stdout except with -O" "autodia -h : display this help message" "autodia -V : display version and copyright message" perl v5.12.4 2011-05-23 AUTODIA(1p)
All times are GMT -4. The time now is 06:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy